I need a way to perform some kind of 'whileonmouseover' function to continue an animation while the mouse overs over an element...
For example, given this function:
$(document).ready(function()
{
function doAlert()
{
alert(1);
}
$('#button').hover(function()
{
doAlert();
});
});
The alert will fire once as the mouse hovers over #button. I need a way to continue having that alert fire while the mouse remains over #button...
I've tried doing some kind of function recursion to continue the alert until a trigger is set causing it to stop:
$(document).ready(function()
{
var doLoop = true;
function doAlert()
{
if (!doLoop) return;
alert(1);
doAlert();
}
$('#button').hover(function()
{
doAlert();
}, function()
{
doLoop = false;
});
});
But that failed. Seems the function completely ignores the 'doLoop = false' assignment in 'hover off'.
Any way to accomplish this?