i’m tring to use jQuery touch swipe to click each li item. this is my html
<div class="slider-active" id="active_885">
<label for="slide1-885"></label>
<label for="slide2-885"></label>
<label for="slide3-885"></label>
</div>
this is my script
jQuery("#slides_885").swipe({
swipeRight:function(event, direction, distance, duration, fingerCount) {
jQuery("#active_885 label:first").click();
},
swipeLeft:function(event, direction, distance, duration, fingerCount) {
jQuery("#active_885 label:last").click();
}
});
with my little knowledge in javascript, i could make the above script to click the first label when swipe right and click the last label when swipe left. But what i want is to make the script click the labels (shown in my html above) in order one by one downwards with each swipe to the right and upwards with swipe left.
hope i could explain the point.
any help??
You can create an array of your
<label>items and iterate through that based on swipes.Something like this:
HTML:
JavaScript: