Demo jsbin
var c=0; $('.slide:gt(0)').hide(); $('#learn').click(function(){ c++; $('.slide').eq(c).css({zIndex:c}).show('slow'); });
HTML:
<div id="slider"> <div id="learn">Learn more</div> <div class="slide s1">I'm slide 1</div> <div class="slide s2">I'm slide 2</div> <div class="slide s3">I'm slide 3</div> </div>
CSS
#slider{ position:relative; width:340px; height:340px; } #learn{ position:absolute; right:0px; z-index:2; cursor:pointer; } .slide{ position:absolute; right:0px; top:0px; width:300px; height:300px; }
If you have a certain number of slides, you can keep the code intact, on the other hand, I suggest you - when the last slide is reached - hide the #learn program code using jQuery. Let me know if you need help with this.
Happy coding
source share