我正在尝试创建一个比 css(显然是我)可以管理的更复杂的效果。
这个想法是让 5 个 DIV 中的一个在页面加载时处于活动状态,然后直到悬停不同的 DIV,前一个保持活动状态。本质上总会有一个活跃的元素。
所需要做的就是隐藏 .promoExpand 并在悬停时显示。
这是我到目前为止所拥有的:
$(document).ready(function(){
$('.promo').mouseenter(function () {
$(this).find('.item').addClass('promoExpand').siblings().removeClass('promoExpand');
});
});
和一大块 HTML。
<div class="promo">
<img src="img/thumb/gratings.jpg">
<h3>Fibreglass</h3>
<div class="item">
<p>These products are for the home. We specialise all of our decking for use by you.</p>
</div>
</div>
感谢大家的帮助,
汤姆