Can jquery .on('click', function(event){}) be changed to trigger when the mouse passes by?
淡淡烟草味2017-06-26 11:00:35
You can also use mouseenter and mouseleave encapsulated by JQ to achieve different effects
漂亮男人2017-06-26 11:00:35
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.
PHP中文网2017-06-26 11:00:35
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");
});