此代码应针对 .refer 类的子元素并分配给它 .ref-hover,但它仅将其分配给 .refer
简单的html:
<div class="refer left">
<div class="desc box">
<h3>Anticorro</h3>
<p>Soundtrack</p>
</div>
<div class="video box">
<iframe>soundcloud iframe</iframe>
</div>
</div>
js在这里:
$(document).ready(function() {
$('.refer').hover(
function () {
$(this).children('.video').addClass('.ref-hover');
}, function () {
$(this).children('.video').removeClass('.ref-hover');
});
});
示例: http: //www.needles.cz(带有 soundcloud 播放器的那些块)
问题出在哪里?