CSS-Tricks / AnythingSlider

A jQuery Slider plugin for anything.
http://css-tricks.github.io/AnythingSlider/
GNU Lesser General Public License v3.0
1.15k stars 380 forks source link

how can i change the currentpage? #595

Closed ChenRenHu closed 9 years ago

ChenRenHu commented 10 years ago

when I add a node into the slider, i want to set it to be the currentpage, how can i do ? in the document , i found the "startPanel" setting, but no working .

Mottie commented 10 years ago

Hi @ChenRenHu!

You can use the api to set the slider to any page (ref):

 $('#slider')
    .append( '<li><img src="image4.jpg"></li>' )
    // update slider
    .anythingSlider()
    // switch slider to whatever page
    .anythingSlider(4);
ChenRenHu commented 10 years ago

thank you @Mottie , it really work.

for the function, the following that what i done: $("#slider").appen(newElement); $("#slider").anythingSlider(); var sliderLength = $("#slider").children().length - 2; sliderLength = sliderLength + 1; $("#slider").anythingSlider(sliderLength);