Next and Prev Wrap
Ever wanted to do a .next() or .prev() on jQuery and make
it automatically wrap around (so if there's no next, just choose the first..)?
Well, it's quite simple, but I made a small script for that.
all you have to do is instead of $('element').next() just write $('element').nextWrap()
and instead of $('element').prev() it's $('element').prevWrap()
Update!
Now it's possible to add a selector (only if you want to :-) )
if you want the next element that is an image, simply write $(this).nextWrap('img')
this will work like the normal jQuery selectors!
Enjoy!
Posted in
jQuery