Search code examples
javascriptjqueryanythingslider

jQuery AnythingSlider - change properties after initial setup


If you have Anything slider setup on a page like something like so

$('.anythingSlider').anythingSlider({
  easing: "easeInOutExpo",
  autoPlay: true,
  delay: 5000,
  startStopped: false,
  animationTime: 600,
  hashTags: true,
  buildNavigation: true,
  pauseOnHover: true,
  navigationFormatter: formatText
});

How can you later change an individual property - say delay=10000?


Solution

  • You can use the API to access the options. In the newest version .anythingSlider isn't the element to initialize AnythingSlider on, it ends up being named as .anythingBase.

    $('#slider').data('AnythingSlider').options.delay = 10000;
    

    I'll update the usage wiki page to show this more explicitly.