Jquery 通过悬停,触发另一个元素';悬停
我想通过如下方式悬停一个元素来触发另一个元素的悬停:Jquery 通过悬停,触发另一个元素';悬停,jquery,hover,mouseenter,Jquery,Hover,Mouseenter,我想通过如下方式悬停一个元素来触发另一个元素的悬停: $(document).ready(function () { $('.quarter h3').mouseenter(function () { $(this).next().trigger('mouseenter'); }); }); HTML是: <div class="quarter grow"> <a href="#"> <h3><s
$(document).ready(function () {
$('.quarter h3').mouseenter(function () {
$(this).next().trigger('mouseenter');
});
});
HTML是:
<div class="quarter grow">
<a href="#">
<h3><span>titel 1</span></h3>
<img src="http://lorempixel.com/200/230/people/1" alt="">
</a>
</div>
看看小提琴:如果我正确理解了你的问题,你可以改变
.grow img:hover {
到
据我所知,您不能使用JavaScript触发CSS
:hover
伪类。我认为,您需要使用jQuery在mouseenter
/mouseleave
上添加/删除一个类。我认为我们以同样的方式理解了这个问题,因为我认为应该这样做。
.grow:hover img {