javascript - Inline JS (OnMouseOver) - Repeat Something Until MouseOut Occurs -


is there way run given function every 10ms, considering limited running inline code (no external js files or tags)?

i can use:

<div onmouseover="functions here" onmouseout="functions here"> 

to more specific want move element left 50px every 10ms using marginleft, can not run externail functions or js libraries mentioned above.

i thinking of maybe incorporating in onmouseover setinterval(function, 10), don't see way of stopping when mouseout occurs.

i know can use jquery event handlers .on, these not option here since have externally loaded (not inline)

set global variable:

<div onmouseover="if (!window.intervalid)                   window.intervalid=setinterval(function() {/*your code*/}, 10);"           onmouseout="clearinterval(window.intervalid); window.intervalid=null;"> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -