Is it possible to add multiple jssor instances on one page? Is it possible to create new class instances dynamically like:
var jssor_slider1 = new $JssorSlider$("slider1_container", options);
The jssor_slider1
variable has to be dynamic. Means the 1 has to changed to a variable itself. var jssor_slider1+VARIABLE
. But I found nothing for this.
Maybe I make thinking mistake.
Thanks
Removing the number(s) after "options" & changing the double quotes to single should allow you to initialize multiple sliders on the same page:
Please initialize multiple instances in following manner,
One setting for all sliders without jQuery:
Different settings for all sliders without jQuery:
I am using php to get information from a mysql database, and it will build several containers which at the end of them all include a slider (dynamically built with images from a folder - So, I don't even know how many sliders. But they will all have the same size/options ... Hence I found a quick, dirty and effective way to work with that...
I loaded all the original javascript with 1 file, it's called sliders.js
It has all the original content as seen below, only difference is I use a class on my sliders and a unique ID (set by PHP/MySQL) - See where I commented.
So, when I load my HTML with PHP, its all original HTML - except the ID is dyanmiacally set depending on the ID of the information I get from database which keeps it unique, in my case the ID's are something like "GameID-2784" etc.
..........
As mentioned, I know it's a dirty way of doing it, But it's very easy and works real good if you're using a lot of sliders with the same options, and you simply just want to give them a 'class' --- and more importantly, do not know the ID's (so you can add them to the java-script.
Would be happy to hear if anyone has a simpler solution!