[英]jQuery/JavaScript Function to Change Style Opacity
我该如何编写一个函数,onmouseover;
提前致谢!
$('.whatever').on('mouseenter', function() {
$('img', this).css('opacity', '0.5');
}).on('mouseleave', function() {
$('img', this).css('opacity', '1');
});
但是,您可以使用纯CSS执行相同的操作:
.whatever:hover img { opacity: 0.5; }
这是一种可能性:
$("#yourDiv").bind("mouseover", function(){
$(this).find("img").css("opacity", "0.5");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.