How to trigger Slider (Nestable) from an external element [SOLVED]

Hi everyone !

I’m trying to write a custom script to make the Slider (nestable) element… slide :smiley: when clicking on a “Next” and “Prev” text links placed in my header.

I added custom attributes to both link so i tried and a script (Settings > Custom Code > Body scripts) to trigger the click on the slider arrows while clicking on them but nothing happens.

I’m no dev so i tried to scavenge ressources on the net and mix it to achieve something but i failed haha

Here’s the script i tried :

<script>
	$(document).on('click', '#slide-prev', function(e) {
		$(".splide__arrow--prev").trigger('click');
	});
</script>

Where “#slide-prev” is the custom ID added to the text link and “.splide__arrow–prev” is the class i target to click on the slider arrow

Have a nice day !

This should help.

1 Like

YOU ARE A GENIUS :star_struck:

Thank you so much, that’s exactly what i was looking for ! It’s working fine !

Have a wonderful day !

You are welcome I’m glad it helped you have a nice day

By the way, if you have hints about a possible implementation of hash navigation inside each slide of the slider element, that could be wonderful :smiley:

THIS IS EXCACTLY WHAT I WAS SEARCHING FOR!!!

The only problem is … I have two sliders on my page … now both sliders are controlled by the arrows.
Is it possible to separate that?
https://new.drivers-posting.eu/

It is possible: NO BUG: Nestable Slider: Customization via JavaScript - #2 by timmse

1 Like