Open ouvanous opened 13 years ago
I realize this is an old question but I figured I'd throw out how I added button controls. Someone may find it useful someday.
I had a long swipe and wanted bookmarks at the bottom to jump to different pages.
I used jquery to locate the carousel, since it renames it and you lose your IDs.
I put it in a div called "swiper" and used that as my starting point. the carousel will be placed in a unnamed div. I suppose if you have one carousel on a page you could add code to the carousel script to add an id to the div or ul.
on my buttons I added a function that passes a number and calculates the new left CSS, which if you what the code in a browser inspector is the number that changes. I multiple the -width of a single page by the passed number. if I want page 1 i pass a 0, page 3 is 2, etc.
function jumper(c){ var distance = -1910 * c; var myCarousel = $("div#swiper > div:first > ul:first"); console.log(myCarousel.width()); myCarousel.css("left", distance +"px"); }
for just next and previous you could set a variable at 0 and onclick of next add a +1 and pass it to a similar function.
Hi,
Is there a way to create previous / next buttons to use with it ? Many thanks,
Samuel