In Wix Studio
I have slider repeater connected to CMS on static page (Home Page), I want to add next and previous buttons without turning it into a slideshow.
any body can help with the required code.
try this
$w.onReady(function () {
// Disable the previous button initially
$w("#prevButton").disable();
// Add an onClick event handler to the next button
$w("#nextButton").onClick(() => {
$w("#myRepeater").next();
// Enable the previous button when next button is clicked
$w("#prevButton").enable();
});
// Add an onClick event handler to the previous button
$w("#prevButton").onClick(() => {
$w("#myRepeater").previous();
// Disable the previous button when the first item is displayed
if ($w("#myRepeater").currentIndex === 0) {
$w("#prevButton").disable();
}
});
});
Thanks Dan,
But I found that “.next”, “.previous”, and “.currentIndex” are not repeater properties
But I found that “.next”, “.previous”, and “.currentIndex” are not repeater properties
Yes, this statement is correct, but i think Dan_Suhr was reffering to SLIDESHOW-API…
You used either a → REPEATER ← or you did use a —> SLIDER ←
A → SLIDER-REPEATER ← do not exist out of my view.
So what kind of element did you use exactly?
Maybe you want first to provide some SCREENSHOT of your setup and show which element you have used?
So it is at the end a → REPEATER with a slider-option.
It’s not a slider, else it would have the NEXT, PREVIOUS and currentIndex functions.
Not sure, but try to control NEXT and PREVIOUS functions of your DATASET, which you have connected to your repeater.
Test it.