jquery - jCarousel resetting scroll position -
i have question resetting scroll position when load new data in jcarousel. link here: http://rjwcollective.com/equinox/rishi_gallery/eqgall.php
new data comes in when click on filters in sidebar on left. however, if start scrolling in carousel on right sidebar , reselect filters, newly loaded data doesn't reset top position.
i emptying out data in div using .empty()
the scenario this:
first load:
//first load $.ajax({ type:"post", url:"sortbystate.php", data:"city=&gender=&category=", success:function(data){ //carousel $('#thumbs').html(data); } });//end ajax
filter selection:
$(".statelist :input").click(function(){ $('#thumbs').empty(); var state = $('.statelist input:checked').attr('value'); var gender = $('.gender input:checked').attr('value'); var category =$('.category input:checked').attr('value'); $.ajax({ type:"post", url:"sortbystate.php", data:"city="+state+"&gender="+gender+"&category="+category, success:function(data){ $('#thumbs').html(data); } });//end ajax });
you can either reset carousel new data loaded:
success:function(data){ carousel.reset(); $('#thumbs').html(data); }
this clear , reset position.
or can call carousel.pos(0); move start.
if need more function best @ function available in source:
https://github.com/jsor/jcarousel/blob/master/lib/jquery.jcarousel.js
Comments
Post a Comment