我有一個指示元素,當我將其懸停時應該消失,替換應該出現在同一個地方。檢測到多個事件,其中應該只有一個
現在,當我離開這個替換時,它現在應該消失,並且舊的指示器應該再次放置它。
這裏是指標或觸發一個HTML:
<div class="help-trigger for-desktop">
<div class="bg">
<h4>HELP ME<i class="icon-double-angle-right"></i><i class="icon-double-angle-left"></i></h4>
</div>
</div>
<div class="help-trigger for-mobile">
<div class="bg">
</div>
</div>
這裏是jQuery代碼:
jQuery('.help-trigger.for-mobile').hover(function(){
jQuery(this).stop(true, true).hide();
jQuery('.help-trigger.for-desktop').stop(true, true).show();
jQuery('.help-trigger.for-desktop').mouseout(function(){
jQuery(this).stop(true, true).hide();
jQuery('.help-trigger.for-mobile').stop(true, true).show();
});
});
這在一般的作品,但它有點閃爍,它是不穩定的。事件被檢測到超過他們應該(更好的話),所以我得到太多的變化,即使我沒有離開.for-desktop
元素
您在每個'。幫助 - 特里格結合mouseout事件er.for-mobile' mouseout/mouseleave。 –