javascript - showing descriptions with simple carousal using jquery -
I am creating a simple sliding carousel which shows an iPhone with 3 screens. Every time you press the next or the last arrow, it slides on the new image. I've found that part, but I'm having trouble showing / hiding text with each slide. Right now, all three text descriptions are showing.
$ (function () {var onSlide = 0; var moveSlide = 0; var imageWidth; $ ('.iphone-overlay .nav-left') .on ('click', function (Ifslide> -1) {onSlide--; doStuff ();};}) $ ('.iphone-overlay .nav-right') .on (click on ', function () {if (OnSlide & lt; 1) {onSlide ++; doStuff ();}}}} function doStuff () {console.log (onSlide); imageWidth = $ ('banner-slider img'). Width (); moveSlide = (ImageWidth / 3) * Onslide; $ ('Banner-Slider IMG'). CSS ('left', leftslide);}
});
} > This is my Jsfiddle:Any help would be appreciated
I Its like Some of the hours played with it and came with this.
All the text is hidden in a .holder.
Then when moving different images, the equivalent
The way the images were wrapped and counted, it had to be replaced.
This is relevant JS
$ (function () {var OnSlide = 0; Var moveSlide = 0; Var Imagewidth; $ ('.iphone-overlay .nav-left'). ('Click', function () {onSlide = onSlide - 1; if (onSlide & lt; 1) {onSlide = 3;} doStuff ();}); $ ('.iphone-overlay .nav-right') ('click', function () {onSlide = onSlide + 1; if (onslide> 3) {onSlide = 1;} doStuff ();}); Function DUSTF () {console.log (onslide); ImageWidth = $ ('Banner-Slider IMG'). Width (); MoveSlide = (imageWidth / 3) * Onslide; $ ('Banner-slider img'). CSS ('left', leftslide); $ ('. Putmehere') HTML (''). // Alert (onslide); $ ('. Patmier') .andend ($ .holder, sulide '+ onslide) .html ()); }});
Comments
Post a Comment