Created
September 26, 2013 02:03
-
-
Save cycyewt/6708866 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var speed = -1, | |
banner = document.getElementById('banner'), | |
main1 = document.getElementById('main1'), | |
wrap1 = document.getElementById('wrap1'), | |
wrap2 = document.getElementById('wrap2'), | |
timer, | |
interval = 15, | |
left; | |
function scroll() { | |
left = banner.offsetLeft; | |
banner.style.left = (left <= -wrap1.offsetWidth) ? 0 : left + speed; | |
timer = setTimeout(scroll, interval); | |
} | |
wrap2.innerHTML = wrap1.innerHTML; | |
timer = setTimeout(scroll, interval); | |
main1.onmouseover = function() { | |
clearTimeout(timer); | |
} | |
main1.onmouseout = function() { | |
timer = setTimeout(scroll, interval); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment