国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript – So stoppen Sie ein Ereignis sofort, nachdem die Ausführung abgeschlossen ist
ringa_lee
ringa_lee 2017-06-14 10:54:31
0
5
958

Ich habe ein Ereignis, das angezeigt und ausgeblendet wird, wenn die Maus mehrmals darüber bewegt wird. Wie kann ich das Ereignis sofort nach der Ausführung des Maus-Aus-Ereignisses stoppen?

$(".target").on('mouseenter',function() {
    $(this).children('.p1').show(function(){
        $(this).addClass('animated fadeInLeft');
        $(this).removeClass('animated fadeInLeft');
    })
});
$(".target").on('mouseleave',function() {
    $(this).children('.p1').hide(function(){
        $(this).addClass('animated fadeOutLeft');
        $(this).removeClass('animated fadeOutLeft');
    })
});
ringa_lee
ringa_lee

ringa_lee

Antworte allen(5)
洪濤

題主如果要用只執(zhí)行一次的方法,用.one()就行,但是一般jQuery的動畫特效一定要考慮動畫隊列的問題,建議在執(zhí)行動畫之前加上.stop()方法來停止“進入動畫隊列但是未完全執(zhí)行完”的動畫

大家講道理
$(".target").on('mouseenter',function() {
    $(this).children('.p1').show(function(){
        $(this).addClass('animated fadeInLeft');
        $(this).removeClass('animated fadeInLeft');
    })
});
$(".target").on('mouseleave',function() {
    $(this).children('.p1').hide(function(){
        $(this).addClass('animated fadeOutLeft');
        $(this).removeClass('animated fadeOutLeft');
    })
    $(this).unbind();    //加一句這個取消當前dom的所有綁定事件
});
黃舟

on后邊加個e,你用.one()這個API它就是執(zhí)行一次自動刪除了。

參考

漂亮男人

你是想說馬上中止動畫吧,用 stop()

$(this).children('.p1').stop(true, true)
學習ing

$(".target").off('mouseenter').on('mouseenter',function() {

$(this).children('.p1').show(function(){
    $(this).addClass('animated fadeInLeft');
    $(this).removeClass('animated fadeInLeft');
})

});
$(".target").off('mouseenter').on('mouseleave',function() {

$(this).children('.p1').hide(function(){
    $(this).addClass('animated fadeOutLeft');
    $(this).removeClass('animated fadeOutLeft');
})

});

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage