I have zero idea what I'm doing and am surprised I made it this far. I'm making an animated banner with Pharma Important safety information that needs to auto scroll. I have it over flow:scrolling and when the animation ends it start to autoscroll, then the animation loops when the copy scrolls back to the top, but the copy keeps scrolling and I need it to wait till the animation ends again.
thing.isi_auto = function(event) {
DivElmnt = document.getElementById('elementID');
DivElmnt.onmouseover = pauseDiv;
DivElmnt.onmouseout = resumeDiv;
ReachedMaxScroll = false;
DivElmnt.scrollTop = 0;
PreviousScrollTop = 0;
ScrollRate = 100;
ScrollInterval = setInterval('scrollDiv()', ScrollRate);
}
function scrollDiv() {
if (!ReachedMaxScroll) {
DivElmnt.scrollTop = PreviousScrollTop;
PreviousScrollTop++;
ReachedMaxScroll = DivElmnt.scrollTop >= (DivElmnt.scrollHeight - DivElmnt.offsetHeight);
} else {
DivElmnt.scrollTop = PreviousScrollTop = 0;
ReachedMaxScroll = false;
}
}
function pauseDiv() {
clearInterval(ScrollInterval);
}
function resumeDiv() {
PreviousScrollTop = DivElmnt.scrollTop;
ScrollInterval = setInterval('scrollDiv()', ScrollRate);
};