using on() with hover - jQuery

后端 未结 7 1284
感情败类
感情败类 2021-01-26 05:51

This is what I have:

$(\'#blah\').hover(function(){
    $(\'etc\').show();
}, function(){
    $(\'etc\').hide();
});

This works just fine, now

7条回答
  •  自闭症患者
    2021-01-26 06:08

    Yes it will not work because when you use .on() with hover then hover event just have one call-back function instead you can use multiple events in .on()

    Try

    $("DOM").on({
        mouseenter: function() {
            // Handle mouseenter...
        },
        mouseleave: function() {
            // Handle mouseleave...
        }
    });
    

提交回复
热议问题