-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
infinite loop #14
Comments
Hi @lcdservices it already works that way. |
I did some more testing and found the issue. If the beginning and final element exist within the containing div at the same time -- even if they are only partially revealed -- the scroller will stop. In my case, I have a scroller that has three "li" elements, each of which is about three lines of text long. by the time it gets to the bottom of the third element, only part of the last line of the first element is exposed. but that is sufficient to stop the scroller from looping -- it just stays with the last element fully exposed and the first element cut off. |
Hey @lcdservices , |
@lcdservices , I got the point now. If the first element is still visible and the 'ul' element is not high enough, it's not possible to finish this turn of scrolling. That makes the scroller stop. You can try to set a larger height of your 'ul' element. See this demo: http://jsbin.com/kegimo/2 |
I worked around it by reducing my containing div slightly (so the first item was off screen by the time the third finished displaying) -- which allowed it to continuously scroll. but it might be something you want to look at improving at some point. nice plugin by the way. very easy to implement. |
I'm experiencing the same issue. However my bulletin items are pulled from a database so it's not possible to know how many there will be or their heights. |
So after some more tinkering with this i think i've come up with a solution. The idea is to check if the last item will fit completely in the // check if the lastItem check is needed
if ( config.infiniteLoop === true && containerUL.outerHeight() > container.outerHeight()) {
var children = $.makeArray(containerUL.children()),
lastItem = children.pop(),
height = 0;
children.forEach(function(item){
height += $(item).outerHeight(true);
});
// check if part of the lastItem is outside of the conatiner
if (height < container.outerHeight() && ($(lastItem).outerHeight(true) + height) > container.outerHeight()) {
containerUL.append(containerUL.children().clone());
}
} The "fix" above is only for vertical scrolling. Hopefully i'll find the time to sort this and create a proper pull request Todo
|
this is so old and banished, if someone interested this should have a new maintainer the problem is the line |
+1 I'm having same problem. |
is there a config option that I'm missing that will allow the scroller to continuously loop -- so when it gets to the end of the
The text was updated successfully, but these errors were encountered: