I have a long list that I want to ‘paginate’ using jQuery Cycle. There’s about 40 items in the list, and I want to show 5 at a time, with a Next/Prev at the bottom.
This is what I’m trying to do: http://jsfiddle.net/saltcod/vmdaM/97/
The first function would divide the list into chunks of 5 items, and then jQuery Cycle would run on the result.
I’ve got the list chunked up into 5 items just fine. But jQuery Cycle keeps telling me that it doesn’t have any divs to work with.
How can I make sure the first function is completely finished slicing up the list before jQuery Cycle initiates?
Thanks
Terry
Indeed as @minitech mentions the for loop is guaranteed to be complete by the time you do your cycle plugin initialization.
The problem is your selector:
The
projectListelement doesn’t have any divs in it, only a singleul.Change your selector like so:
Of course… your
wrapAllcall has made the markup incorrect. You now haveul > div > liwhich is almost certainly not valid… But hey, it should work anyway, at least get you a little further 🙂