我有一个小问题。
$('.item').mouseenter(function() {
setTimeout(function() {
$(this).find('.item-overlay').css('z-index', '-1');
}, 300);
}).mouseleave(function() {
$(this).find('.item-overlay').css('z-index', '');
});
<div class="item">
<div class="item-overlay">
</div>
<iframe>...</iframe>
</div>
一切工作正常,除了一件小事。 z-index不会改变。你们能帮我解决这个问题吗? 我也试着用“未来”,“儿童”,“发现” - 没有工作:(
是您的元素绝对定位? –
.item是相对的,.item-overlay是绝对的...... T.J Crowder的解决方案就像一个魅力。谢谢! –