-1

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.

user2310422
  • 555
  • 3
  • 9
  • 22

1 Answers1

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
})

Fiddle

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
  • You can try .mousemove() of jquery – Anjith K P May 26 '13 at 09:18
  • .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
  • SOrry, I don't getting your requirement – Anjith K P May 26 '13 at 09:20