Plugin Support
Gabor
(@nextendweb_gabor)
Hi @mstudioil!
The IDs of our sliders are starting with #n2, not with #ns, so I think that will be the cause your problem:
_N2.r('#n2-ss-2', function(slider){
jQuery('.specialties').click(function(){
console.log("specialties clicked");
});
});
Also, this part:
_N2.r('#n2-ss-2', function(slider){
});
means, that you only want your code to start once our slider loaded, and we return some datas within the “slider” variable. If you don’t want to use the “slider” variable, as you just want to hide/show something on your page, you won’t really need our code at all, but you could use simple jQuery:
jQuery(document).ready(function(){
jQuery('.specialties').click(function(){
console.log("specialties clicked");
});
});
This should work as well and pure jQuery might be easier to debug or see issues with it.
Thanks, I don’t know why I add #ns and not #n2. maybe I copied wrong or typed to fast
I added moving the other slide, but it now working
_N2.r('#n2-ss-2', function(){
jQuery('.specialties').click(function(){
console.log("specialties clicked");
var slider = _N2['#n2-ss-2'];
slider.slideToID(0);
});
});
I used https://smartslider.helpscoutdocs.com/article/1729-move-slides-with-javascript#id
Plugin Support
Gabor
(@nextendweb_gabor)
In this code this part will be wrong:
slider.slideToID(0);
slideToID means, that you are using the slide’s ID number to identify it:
https://smartslider.helpscoutdocs.com/article/1955-slider-and-slide-id#slideid
which is a bigger than 0 number. If you check out the real ID number as written in this documentation, that should work out well.
Or use:
slider.slide(0);
instead, to switch to the 1st slide.
If it still won’t work out, please send me a link to your page, either here or to support@nextendweb.com and we will take a look!
I still working on it, I using slider.slide(0); it easier not to search for the id, it is easy when you know it is array 0 zero based.
I used this before, I changed because what I saw in the example
slider.slide(0); is better.
By the way, I think you have error here
https://smartslider.helpscoutdocs.com/article/1729-move-slides-with-javascript#id
It wrote
For the tutorials, I’ll use 1 as the slider ID.
but the code is
_N2.r('#n2-ss-10', function(){
var slider = _N2['#n2-ss-10'];
slider.previous();
});
So the id is 10
-
This reply was modified 4 years, 7 months ago by
mstudioIL.
-
This reply was modified 4 years, 7 months ago by
mstudioIL.
I have other question, how it is better to use to code?
like this:
_N2.r('#n2-ss-2', function(){
jQuery('.specialties').click(function(){
var slider = _N2['#n2-ss-2'];
slider.slide(1);
jQuery('.first-text').addClass('hide-text');
jQuery('.product-detail').css({"display":"none","visibility":"hidden"});
jQuery('#product-specialties').css({"display":"block","visibility":"visible"});
});
});
_N2.r('#n2-ss-2', function(){
jQuery('.personal-care').click(function(){
var slider = _N2['#n2-ss-2'];
slider.slide(2);
jQuery('.first-text').addClass('hide-text');
jQuery('.product-detail').css({"display":"none","visibility":"hidden"});
jQuery('#product-personal-care').css({"display":"block","visibility":"visible"});
});
});
or it is better to use one _N2.r('#n2-ss-2', function(){...}
and add the code there?
I going to add hover function to all the function and I have 7 functions
-
This reply was modified 4 years, 7 months ago by
mstudioIL.
Plugin Support
Laszlo
(@laszloszalvak)
Hi @mstudioil
The codes inside the anonymous function:
_N2.r('#n2-ss-2', function(){
...
});
will run when the slider with the ID 2 is ready, so you don’t need to put this code into the function itself again and again.