4:20 PM A simple example of Image slider in HTML and Javascript |
Many times we have to add an image slider or banner on the home page of a website. This usually contains a set of rotating imgaes containing links to most important contents of your website. So an image slider gives an attractive look to your website and exhibites a nice presentation of your contents. Here we will learn to create a basic image slider using HTML and Javascipt. We will just put a set of images and then we will give it animation. There will be two button that can be used to move the picture slider left and right. In the Body tag we will put below code that is simply adding a set of images. Also, it will add two picture buttons that can be used to move printers left and right.
In the head tag, we put following script. The below script is working on click of the small picture buttons having ids moveleft,moveright. On click of them, we call a function to animate the pictures. We have decremented the left margin by some value to move it left and incremented it to move it right. The pictures are having id "div1" which is used to animate.
Also, this script is using JQuery, so make sure you place the jquery.js script at the same place/folder where your image and HTML file is. You can get the source code here |
|
Related blogs
You may also like to see:
[2014-09-30] | [Technical Solution] |
How to give a global url to an HTML page? How to create a website with custom url? |
[2015-02-09] | [Technical Solution] |
Soving Rubik's Cube Second layer: Layered approach by Shanky |
[2015-04-02] | [Technical Solution] |
Outlook is full!! Solutions?? |
[2014-09-27] | [Technical Solution] |
TRACERT command in Windows Command Line |
[2022-07-24] | [Technical Solution] |
How to handle Criticism at work? An Insight by Mark Goulston (Harvard's Business review article) |
Total comments: 0 | |