Guest User

Untitled

a guest
Jan 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. var marquee = $('div.marquee');
  2. marquee.each(function() {
  3. var mar = $(this),indent = mar.width();
  4. mar.marquee = function() {
  5. indent--;
  6. mar.css('text-indent',indent);
  7. if (indent < -1 * mar.children('div.marquee-text').width()) {
  8. indent = mar.width();
  9. }
  10. };
  11. mar.data('interval',setInterval(mar.marquee,1000/60));
  12. });​
  13.  
  14. <div id="scrollcontainer" style="postion:relative; overflow:hidden; width:100%;">
  15. <span id="scrolltext" style="position:absolute; white-space:nowrap">this is the scrolling text</span>
  16. </div>
  17.  
  18. function scroll() {
  19. $('#scrolltext').css('left', $('#scrollcontainer').width());
  20. $('#scrolltext').animate({
  21. left: '-='+($('#scrollcontainer').width()+$('#scrolltext').width())
  22. }, 2000, function() {
  23. scroll();
  24. });
  25. }
  26.  
  27. scroll();
Add Comment
Please, Sign In to add comment