I have a div element and a I want to fire a function when mouse enters it.
But it is really in the center of the page so mouse is usually on it on page load and function runs.
Is there a way to make it so my function doesn’t run when mouse is already in but when enter?
<div id = "mouse-control-div">.....</div>
<script type="text/javascript">
$('#mouse-control-div').mouseover(function() {alert('some thing');});
</script>
I also tried .mouseenter but the same result.
(code sample is added)
What if you have a boolean that tells you if you already have entered?
For information about the jQuery Events: MouseOver / MouseOut vs. MouseEnter / MouseLeave look here
For the working demo look here