Roxio Ben
Roxio Ben

Reputation: 11

JSSOR - keep current slider position after every web page refresh

I am just installed beautifull Jssor Slider called "Nested slider" (sources can be downloaded for free from web page: http://www.jssor.com/demos/nested-slider.html).

Could you please advice how can I get the following behaviour:

Every main slider and subsliders contains quite lot of images which run in slideshow process. I would need possibility to keep slideshow continuesly even if it will be disturbed by web page refresh (for example when customer will change product, etc). In practice, when slideshow would be on second position "Motor" and Image number 7 and web page would be refreshed I want, that after page refresh, the cutomer would keep watching this slideshow begining from this 2nd positoin "Motor" and image number 7. Currently, after every web page refresh the slideshow starts from the beginning, it means from 1st position "Landscape" and image number 1.

Is that would have to affect cookies somehow ? Is that very hard to implement ? I would be thankfull for exact code which would be ready to go.

Kind Regards, Ben

Upvotes: 0

Views: 701

Answers (1)

jssor
jssor

Reputation: 6985

There is an option $StartIndex which enables you display a specified slide of a slider at the beginning.

var options = {
    ...
    $StartIndex: lastviewed_slide_index,    //Index of slide to display when initialize, default value is 0
    ...
};

Given the nested slider example, you can use the following statements to retrieve last viewed index.

var main_slider_lastviewed_index = jssor_slider1.$CurrentIndex();
var child_slider_lastviewed_index = nestedSliders[main_slider_lastviewed_index].$CurrentIndex();

Upvotes: 3

Related Questions