JavaScript: mouseenter event in javascript?

Is there a mouse input event in javascript (JavaScript only, no jQuery to use, please)?

When I do this, he does not give an answer.

window.onload = initAll; function initAll(){ if(window.addEventListener){ document.getElementById('container').addEventListener( 'mouseenter', freeze , false); } } function freeze(){ console.log("mouse entered") } 

Can someone explain me the difference between "mouseenter" and "mouseover"? Is "mouseover" an alternative to "mouseenter"?

Help rate!

+4
source share
4 answers

Do not bother yourself onmouseenter , as this page indicates its specifics for IE.

... both onmouseenter and onmouseover fire when the mouse enters the border of the element. However, onmouseenter does not start again (does not bubble) if the mouse enters a child in this first element.

Try this for onmouseover :

 yourObject.onmouseover=function() { //SomeJavaScriptCode }; 

Check this page for some good javascript mouse event information.

+3
source

Definitely, Mouseover is an alternative to mouseenter. It gives control over the user interface of any home access element. see this for further explanation http://dean.edwards.name/weblog/2005/10/add-event/ mouseenter without jQuery

0
source

If you are using jQuery, use mouseenter and mouseleave instead of mouseover and mouseout .

enter image description here

If you take the example above, everything inside the border is an element, let it name the word β€œName” in it #A. mouseenter will only fire when moving the mouse inside the border #A. mouseover on the other hand, will fire when you enter the frame, again when you move the mouse past the gray background behind β€œ1”, and again when you hover over the word β€œName”. If you want the event to fire once, use mouseenter .

0
source

A mouse is used when you just point something at something. A mouse is entered (or mousedown), which should be used when the mouse is clicked. A complete list of javascript events can be found here.

-2
source

Source: https://habr.com/ru/post/1482381/


All Articles