I have a simple animation on my website, by default I only display the frame1. My goal is, when the user hover the image, I want to keep executing the next frames. I've tried using mouseenter and mouseover functions. But they only both execute the functions if you are moving the mouse inside the container. I want to keep executing the functions only when the mouse is inside the container and even it is not moving.
Asked
Active
Viewed 160 times
-1
-
please create fiddle to know what you have tried – Anjith K P May 26 '13 at 08:10
-
$(this).mouseover(function(){-code here}); – user2310422 May 26 '13 at 08:23
-
That's my fiddle now what? – user2310422 May 26 '13 at 08:46
-
Provide both html and js code or paste the code in http://jsfiddle.net/ – Anjith K P May 26 '13 at 08:48
-
isn't this enough $(this).mouseover(function(){-code here})? All I need is additional function that allows the mouseover to keep firing once the mouse is inside the container. You don't need to go as far as pasting the html as well. – user2310422 May 26 '13 at 08:51
1 Answers
0
Hope this will help you,
HTML
<img src="https://www.google.co.in/images/srpr/logo4w.png"/>
Js:
$('body').delegate('img', 'mousemove', function(e) {
alert(e.type)
//write your code here
})

Anjith K P
- 2,158
- 27
- 35
-
Nope, this is not what I am looking for. Basically I want to repetedly keep firing (ex: alert(e.type)) as long as the user is inside the container. Once the user leave(mouseleave) the container, do nothing. Your code will keep firing even even the user's mouse is outside the container. – user2310422 May 26 '13 at 09:11
-
-
.mousemove() will only fires once you MOVE the mouse which basically the opposite of what I am looking for. I want to keep firing the function even if the mouse is not moving as long as the mouse is inside the container. – user2310422 May 26 '13 at 09:19
-