javascript - Can jquery .on('click',function(event){}) be changed to trigger when the mouse passes by?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-06-26 10:58:35
0
4
778

Can jquery .on('click', function(event){}) be changed to trigger when the mouse passes by?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(4)
学霸

mouseover

淡淡烟草味

You can also use mouseenter and mouseleave encapsulated by JQ to achieve different effects

漂亮男人

I wrote it wrong, it should be a selector in front of it. It should be $("xxx").on("mouseenter",function(){}). This is triggered when the mouse enters. If you want to change it to trigger after leaving, change it to 'mouseleave'. Or use 'hover'. It is not recommended to use the three events of mouseover, mouseout, and mousemove. Mouseover and mouseout will also trigger events when entering or leaving child elements. The mousemove event is triggered too frequently and too high.

Ty80

If you just want to bind the mouse floating event, look at the code above. If you just want to trigger the click, look at the code:

$('p').on("mouseover",function(e){
    $(this).trigger("click");
});
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!