So I understand that there are many plugins - jCarousel to name one, which allow infinite (circular) scrolling of the elements.
Firstly, most of these are designed for image gallery scrolls - I am working with verticle columns of text, which is quite hard to get correct with the css structures they enforce (using li/ul rather than div's).
Secondly, I also want to be dynamically remove a specific column from within my scroller - and for the scroller to automatically adjust itself - again, these plugins seem not to support such a thing.
I figured, it would be much better for maintainability and future adaptability reasons, do not restrict myself by using such a plugin, but rather, add functionalities to my already existing code.
TLDR: I need a way of doing circular scrolling, preferably some sort of manipulation on the scrollLeft() function, or by using another function, but NOT a plugin such as jCarousel/jCycle etc
WOW! This is great - just what I needed, thank you! :)
Just one quick question - suppose I wanted 4 columns on show at once, and the next and previous columns to scroll 608px - ie. show the next 4 columns, would I just add the following lines to the next function ? :
I'm also not sure how it would have compared doing it recursively compared to a for loop, but I am sure that recursively is more expensive, as not only do you have to have some sort of counter/while loop - you are also function calling ?
But yes - thank thank THANK you for all your help - I was looking for ages using plugins, and most of them were overcomplicated, and I couldn't get the layout how I wanted :)!
Also, finally can I just quickly ask - with regard to the columns, suppose I wanted to use the mousewheel for scrolling using the jquery mousewheel plugin, how would I call the function which scrolls the columns back and forward ? I have this code so far, however I am not sure where within the code above I have to assign a function to a variable ( the way I was trying prevented the regular scrolling to work! ) :
Hm - it seems as though if I use this, if I alert(delta), it always comes out undefined - and so always executes the line $('#previous-column').click()
However, if I remove the function oneWheel bit, and the call to .one - it works fine, (although obviously if I scroll my mousewheel more than once it goes round like crazy!) - I'm not sure why removing this would make such a difference
Thank you - strange, it seemed that it produced a delta value if I just included the jquery library if I didn't I didn't have the enclosing function oneWheel, and if I didn't use .one, but would only produce a delta value WITH these bits if I included the seperate mouse wheel plugin