-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from mzubair21/pr2
Added Slider in JS
- Loading branch information
Showing
6 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<html> | ||
|
||
<head> | ||
<link rel="stylesheet" type="text/css" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container2"> | ||
<img class="img" src="2.jpeg"> | ||
<img class="img" src="3.jpeg"> | ||
<img class="img" src="4.jpeg"> | ||
<button id="btn" onclick="btn(-1)" class="l">❮</button> | ||
<button id="btn" onclick="btn(1)" class="r">❯</button> | ||
</div> | ||
<script> | ||
var index=0; | ||
|
||
slide(index); | ||
function slide(image) | ||
{var all=document.getElementsByClassName("img"); | ||
var i; | ||
if(image>=all.length) | ||
{index=0;} | ||
if(image<0) | ||
{index=all.length-1} | ||
|
||
for(i=0;i<all.length;i++) | ||
{ | ||
all[i].style.display="none"; | ||
} | ||
|
||
all[index].style.display="block"; | ||
} | ||
|
||
function auto(){ | ||
setTimeout(auto,5000); ///set miliseconds here. | ||
|
||
//forward | ||
index=index+1; | ||
slide(index); | ||
/// | ||
} | ||
auto(); | ||
|
||
function btn(n){ | ||
|
||
index=index+n; | ||
slide(index); | ||
|
||
} | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.container2{ | ||
width: 60%; | ||
height: 60%; | ||
border: 3px solid black; | ||
position:relative; | ||
top:18%; | ||
margin: 0% auto 100px auto; | ||
top:300; | ||
|
||
} | ||
.container2>img{ | ||
width:100%; | ||
height:100%; | ||
position: absolute; | ||
box-shadow: 0px 0px 25px 2px black; | ||
|
||
} | ||
#btn{ | ||
position: absolute; | ||
top:50%; | ||
background-color: rgba(255,255,255,0.1); | ||
color:white; | ||
border:none; | ||
height: 8%; | ||
width:30px; | ||
} | ||
#btn:hover{ | ||
opacity: 1; | ||
background-color: black; | ||
} | ||
#btn.r{ | ||
position: relative; | ||
float:right; | ||
} | ||
|