Super Simple Slideshow
Today I would like to discuss with you a really simple way of creating a slideshow. Hopefully by the end of this tutorial you will have some idea of how to implement your own slide show. Feel free to use my code in your projects. If you have any comments or suggestions I would love to hear from you.
What we will use
We will use a combination of Html, CSS and JavaScript; specifically jQuery.
How it will work
The slideshow will slide through the images at a set interval and will also have back and forward buttons.
Most of the magic is in the CSS. So if you’re a CSS pro then this will be a breeze. The jQuery is used to add and remove style elements and to animate between the changes.
The slideshow works by lining the images up horizontally by using the float attribute and viewing them through a window that has the ‘overflow’ property set to ‘hidden’. The jQuery moves the slides back and forth by adjusting the left margin of the div that contains all the images.
Let’s make a slideshow
The first stage is to set up the html as follows:
- <div id="slideShow">
- <div id="slideShowWindow">
- <div class="slide">
- <img src=”img1.png”/>
- <div class="slideText">
- <h2>The Slide Title</h2>
- <p>This is the slide text</p>
- </div><!--</slideText> -->
- </div> <!-- </slide> repeat as many times as needed -->
- </div><!--</slideShowWindow> -->
- </div><!--</slideshow> -->
- img {
- display: block;
- width: 100%;
- height: auto;
- }
- p{
- background:none;
- color:#ffffff;
- }
- #slideShow #slideShowWindow {
- width: 650px;
- height: 450px;
- margin: 0;
- padding: 0;
- position: relative;
- overflow:hidden;
- margin-left: auto;
- margin-right:auto;
- }
- #slideShow #slideShowWindow .slide {
- margin: 0;
- padding: 0;
- width: 650px;
- height: 450px;
- float: left;
- position: relative;
- margin-left:auto;
- margin-right: auto;
- }
- #slideshow #slideshowWindow .slide, .slideText {
- position:absolute;
- bottom:18px;
- left:0;
- width:100%;
- height:auto;
- margin:0;
- padding:0;
- color:#ffffff;
- font-family:Myriad Pro, Arial, Helvetica, sans-serif;
- }
- .slideText {
- background: rgba(128, 128, 128, 0.49);
- }
- #slideshow #slideshowWindow .slide .slideText h2,
- #slideshow #slideshowWindow .slide .slideText p {
- margin:10px;
- padding:15px;
- }
- .slideNav {
- display: block;
- text-indent: -10000px;
- position: absolute;
- cursor: pointer;
- }
- #leftNav {
- left: 0;
- bottom: 0;
- width: 48px;
- height: 48px;
- background-image: url("../Images/plus_add_minus.png");
- background-repeat: no-repeat;
- z-index: 10;
- }
- #rightNav {
- right: 0;
- bottom: 0;
- width: 48px;
- height: 48px;
- background-image: url("../Images/plus_add_green.png");
- background-repeat: no-repeat;
- z-index: 10; }

Bhuvanesh MohankumarPosted May 11, 2016, 4:07 AM
Good one, if you have used CDN Jquery, please add the link for Jquery file, which may help beginners to copy code directly and execute while learning.
Rupali ShindePosted Feb 23, 2016, 5:20 AM
nice
Pankaj Kumar ChoudharyPosted Feb 17, 2016, 10:47 AM
Nice Explain Michel , It could be more better if you show some images. If you show image then it will easy for a user to understand that what kind of output will obtain for above coding....
Santhakumar MunuswamyPosted Feb 16, 2016, 2:39 PM
Thanks for nice article