Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var marquee = $('div.marquee');
- marquee.each(function() {
- var mar = $(this),indent = mar.width();
- mar.marquee = function() {
- indent--;
- mar.css('text-indent',indent);
- if (indent < -1 * mar.children('div.marquee-text').width()) {
- indent = mar.width();
- }
- };
- mar.data('interval',setInterval(mar.marquee,1000/60));
- });
- <div id="scrollcontainer" style="postion:relative; overflow:hidden; width:100%;">
- <span id="scrolltext" style="position:absolute; white-space:nowrap">this is the scrolling text</span>
- </div>
- function scroll() {
- $('#scrolltext').css('left', $('#scrollcontainer').width());
- $('#scrolltext').animate({
- left: '-='+($('#scrollcontainer').width()+$('#scrolltext').width())
- }, 2000, function() {
- scroll();
- });
- }
- scroll();
Add Comment
Please, Sign In to add comment