I have a scroll function:
Code:
function scroll()
{
if (parseInt($("text1").style.top) <= 0)
{
$("text2").style.top = parseInt($("text1").style.top) + $("text1").getHeight() + 'px';
}
if (parseInt($("text2").style.top) <= 0)
{
$("text1").style.top = parseInt($("text2").style.top) + $("text2").getHeight() + 'px';
}
$("text1").style.top = parseInt($("text1").style.top) - 1 +'px';
$("text2").style.top = parseInt($("text2").style.top) - 1 +'px';
}
It works fine...
The content is returned via ajax from php like this:
PHP Code:
echo(" <div onmouseover = 'clearInterval(Scroll);' onmouseout = 'Scroll = setInterval (\"scroll()\", 50);'> <div class = 'Source'>".$term[0]."</div> <div class='Title'><a href='".$item[Url]."' target='_blank' style='color:yellow;'><b>".$item[Title]."<b></a></div> <div class='Description'>".$item[Snippet]."</div> <br> <div> ");
The mouse events are to stop the scrolling when the user mouses over the div.
Problem is if the mouse is swiped from one div directly to the next, multiple setIntervals are created.
To see this visit http://ticktach.com CAUTION! if you create too many setIntervals, it will hang your browser.
Anybody know how I can get around this?
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
|