jquery - resetting bxSlider -


i took different direction carousel implemented, opting bxslider instead of jcarousel. image gallery building http://rjwcollective.com/equinox/rishi_gallery/eqgall.php

the issue running when reset filters, or select different filter, slider doesn't reset. code inital load:

    //first load $.ajax({     type:"post",     url:"sortbystate.php",     data:"city=&gender=&category=",     success:function(data){             //carousel              $('#thumbs').html(data);               //alert("whoa, careful there!");                  $('#thumbs').bxslider({auto: false, mode:'vertical',                             autocontrols: false,                             autohover: true,                             pager: false,                             displayslideqty: 4,                             speed:800,                             infiniteloop: true,                                   moveslideqty: 4,                              controls: true});     }  });//end ajax 

this code handling change of filter:

$(".statelist :input").click(function(){      var carousel = $('#thumbs').data('jcarousel');       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){                     //alert("whoa, careful there!");                      $('#thumbs').html(data);                          $('#thumbs').bxslider({auto: false, mode:'vertical',                                     autocontrols: false,                                     autohover: true,                                     pager: false,                                     displayslideqty: 4,                                     speed:800,                                     infiniteloop: true,                                           moveslideqty: 4,                                      controls: true});                       //$('#thumbs').jcarousel('add', index, data);             }           });//end ajax     }); 

i referred bxslider's documentation , had built-in function handle reset: destroyshow(): function()
reloadshow(): function()

i confused doing wrong. tried emptying carousel div before loading data, using .empty(), no dice.

thoughts?

edit: link bxslider website: http://bxslider.com/

declaring "myslider" variable outside document-ready block solved problem me:

var myslider; $(function(){     myslider= $('#slider').bxslider({         auto: true,         controls: true     });      myslider.reloadshow(); }) 

alex


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -