我有一个按钮(锚标签):
/* Custom Config */
var ProgramID = '1111';
/* Default Config */
var webpack = require('webpack');
var path = require('path');
var polyfill = require("babel-polyfill");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var BUILD_DIR = path.resolve(__dirname, 'build/Programs/' + ProgramID);
var APP_DIR = path.resolve(__dirname, 'src/import');
module.exports = {
entry: [
'babel-polyfill',
'webpack-dev-server/client?http://localhost:8080/',
APP_DIR + '/import.js'
],
output: {
path: BUILD_DIR + '/',
filename: '/js/bundle.js',
publicPath: '../Programs/' + ProgramID
},
module: {
loaders: [{
test: /\.jsx?$/,
loaders: ['react-hot', 'babel?presets[]=es2015,presets[]=react,plugins[]=transform-runtime'],
exclude: /node_modules/
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
}, {
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}, {
test: /\.(png|woff|woff2|eot|ttf|svg|jpg|gif)$/,
loader: 'file-loader?name=/images/[name].[ext]'
}]
},
plugins: [
new ExtractTextPlugin("style.css"),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
process: function(path, filename) {
if (filename.indexOf('node_modules') === -1) {
path = babelJest.process(path, filename);
path = webpackAlias.process(path, filename);
}
return path;
},
externals: {
"jquery": "jQuery"
}
};
我正在使用<a href ng-if="!isLogin" class="dropdown-toggle" data-toggle="dropdown">
<b class="white-link">Login</b>
<span class="caret white-link"></span></a>
自定义css类将颜色应用于登录按钮。
当我将鼠标悬停在登录按钮上时,css类仅应用于按钮,但是我想将它应用于按钮和插入符号,当我将鼠标悬停在插入符号上时,同样适用。我怎么做角度?
答案 0 :(得分:2)
这与javascript和angular
无关
只需定义你的css类
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<style>
.white-link:hover { color: red !important}
</style>
<a href class="dropdown-toggle" data-toggle="dropdown" >
<span class="white-link">
<b>Login</b>
<span class="caret"></span></span></a>
答案 1 :(得分:1)
您可以使用ngMouseover
,ngMouseleave
和ngClass
指令在悬停时应用css并在mouseleave上删除它。
<button ng-class="{'white-link': login}" ng-mouseover="login = true" ng-mouseleave="login = false">Login</button>
<span ng-class="{'white-link': login}" ng-mouseover="login = true" ng-mouseleave="login = false">Text</span>
在悬停到登录按钮和范围元素时,white-link
类将同时应用于按钮和范围。
请参阅此PLUNKER。