pause jquery animation on click

Chaitaalams

New Member
I have a question in relation to this topic: http://stackoverflow.com/questions/11777172/jquery-infinite-vertical-loop-like-slot-machine/15783485 Here is the jQuery code:\[code\]$(document).ready(function() {$(".marqueeElement").last().addClass("last");$(".mholder").each(function() { var i = 0; $(this).find(".marqueeElement").each(function() { var $this = $(this); $this.css("bottom", i); i += $this.height(); });});$('#start').click(function() { var countScrolls = $('.mholder .marqueeElement').length; for (var i=0; i < countScrolls; i++) { doScroll($('.mholder .marqueeElement:nth-child(' + i + ')')); }});$('#stop').click(function() { $ele.animate('pause');});});function doScroll($ele) { var bottom = parseInt($ele.css("bottom")); if (bottom < -60) { //bit arbitrary! var $lastEle = $ele.closest('.mholder').find(".last"); $lastEle.removeClass("last"); $ele.addClass("last"); var bottom = (parseInt($lastEle.css("bottom")) + $lastEle.height()); $ele.css("bottom", bottom); } $ele.animate({ bottom: (parseInt(bottom) - 60) }, 900, 'linear', function() { doScroll($(this)) });}\[/code\]I also want to know which part of the code should I modify to lessen the gap when it loops again.Any help will be much appreciated! :)
 
Back
Top