0

nivoslider doesn't include a destroy or initializing method. after simulating destroy using the following code:

$('#slider').data('nivo:vars').stop = true;
$('#slider').find('div.nivo-slice').remove();
$('#slider').find('div.nivo-caption').remove();
$('#slider').find('div.nivo-controlNav').remove();
$('#slider').removeAttr("style");
$('#slider').empty();                               
$(window).unbind('keypress');

and using $('#silder').nivoSlider() again it get stuck at the first image.

pouya
  • 3,400
  • 6
  • 38
  • 53

1 Answers1

0

Ok the best way is to forget about all the destroying thing and replace the silder with it's initial state. suppose the initial state of silder is:

<div id="silder" class="nivoSlider"></div>

Then the best way to do the destroying and initializing at one step is to do something like:

$('#silder').replaceWith('<div id="slider" class="nivoSlider"></div>');
pouya
  • 3,400
  • 6
  • 38
  • 53