An "if mouseover" or a "do while mouseover" in JavaScript/jQuery

Viewed 30211

Is there a JavaScript or jQuery solution to run a function repeatedly (after setTimeout) while the mouse is over a DOM object? Otherwise said, is there a JavaScript "do while mouseover" (or "if mouseover")?

    $('someObject').bind('mouseover', function() {

        //Do the following while mouseover 
        $('someOtherObject').css('margin-left',adjustedLeft + 'px');
        setTimeout(/*do it again*/,25);

    });
5 Answers
OBJ.addEventListener("mouseenter", function() {
  focus=true;
});
OBJ.addEventListener("mouseleave", function() {
  focus=false;
});

Just in case you don't want to use jquery you can use this :)

Related