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

javascript - 如何在事件執(zhí)行完畢後立刻停止事件
ringa_lee
ringa_lee 2017-06-14 10:54:31
0
5
956

我有一個(gè)滑鼠移入移出顯示隱藏的事件,但是滑鼠如果多次滑過(guò)就會(huì)執(zhí)行多次,如何在滑鼠移出事件執(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');
    })
});
ringa_lee
ringa_lee

ringa_lee

全部回覆(5)
洪濤

題主如果要用只執(zhí)行一次的方法,用.one()就行,但是一般jQuery的動(dòng)畫(huà)特效一定要考慮動(dòng)畫(huà)隊(duì)列的問(wèn)題,建議在執(zhí)行動(dòng)畫(huà)之前加上.stop()方法來(lái)停止「進(jìn)入動(dòng)畫(huà)隊(duì)列但是未完全執(zhí)行完」的動(dòng)畫(huà)

大家講道理

雷雷

黃舟

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

參考

漂亮男人

你是想說(shuō)馬上中止動(dòng)畫(huà)吧,用 stop()

$(this).children('.p1').stop(true, true)
學(xué)習(xí)ing

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

雷雷

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

雷雷

});

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板