Hide/collapse Slideshow Slides

Hi there

I’m wondering if its possible to hide and show a specific slide from a slidshow in Wix Code.
The goal is to show a specific slide only, if Wix Code give that assignment.

I’m searching since hours for a solution…

I would be grateful for your help.

Hi Support,

Are you aversed to creating two slideshows, one with the slide, and one without it?

If that’s fine with you, you can then hide/show the slideshow which is relevant based on the data.

If not, you can try adding a handler function for the onChange event of the slideshow, to quickly skip over the slide that’s not relevant. A bit hacky tacky, but it should work. Set the value of timedelay to whatever your slide delay is set to.

/**
Say You had 3 Slides, and you wanted to skip slide two if myTruthStatement is false;
*/
$w("#mySlideshow").onChange( (event, $w) => { 
 let currentIndex = event.target.currentIndex; // 1
 if(currentIndex ===1)
 {
      myTruthStatement == true? 
      /* Go to slide two if it's true */goto(2,1000) : 
      /* Skip slide two if it's false */ goto(3,1000);
 } 
} ); 

function goto(slideNumber,timedelay){
     setTimeout( ()=>{$w("#mySlideshow").changeSlide(slideNumber)} , timedelay);
}
1 Like

Hi Chris

Thank You so much for You answer. The second solution is really good!
I will try to implement the hacky tacky solution into my Code. :slight_smile:

I really appreciate your help - Thanks.

Hi Andy,

Did you able to get your solution?

Actually i am also looking for the same.