<! DOCTYPE html>
<meta charset= "UTF-8" >
<title></title>
<style>
* {
margin:0px;
padding:0px;
}
#stage {
width:400px;
height:40px;
BORDER:3PX solid black;
margin:100px;
Overflow:hidden;
position:relative;
}
#banner {
width:2400px;
height:300px;
Background-color:rosybrown;
}
. Items {
width:400px;
height:40px;
Color:white;
font-size:25px;
Text-align:center;
line-height:300px;
Float:left;
}
. Btn-l,
. btn-r {
width:50px;
height:300px;
Background-color:black;
opacity:0.5;
Color:white;
font-size:40px;
line-height:300px;
Text-align:center;
Position:absolute;
top:0px;
}
. btn-l {
left:0px;
}
. btn-r {
right:0px;
}
. Btn-l:hover,
. btn-r:hover {
Cursor:pointer;
/* Transparency */
opacity:0.2;
}
</style>
<body>
<div id= "Stage" >
<div class= "Btn-l" >
<</div>
<div class= "Btn-r" >></div>
<div id= "banner" >
<div class= "Items" style= "" > Flat real properties xxxx set </div>
<div class= "Items" style= "" > Binh Duong Real Online trading xxxx sets </div>
<div class= "Items" style= "" > Binh Duong Real Online trading xxxx sets </div>
<div class= "Items" style= "" > Binh Duong Real Online trading xxxx sets </div>
<div class= "Items" style= "" > Binh Duong Real Online trading xxxx sets </div>
<div class= "Items" style= "" > Flat real properties xxxx set </div>
</div>
</div>
</body>
<script>
var btn_l = document.getelementsbyclassname (' btn-l ') [0];
var btn_r = document.getelementsbyclassname ("btn-r") [0];
var banner = document.getElementById ("banner");
var count = 1;
var arr = [];
Btn_r.onclick = function () {
if (Count < 6) {
count++;
Arr.push (Window.setinterval ("Move_left ()", 20));
} else if (count = = 6) {
Count = 1;
Banner.style.marginLeft = 0 + "px";
count++;
Arr.push (Window.setinterval ("Move_left ()", 20));
}
}
Btn_l.onclick = function () {
if (Count > 1) {
count--;
Arr.push (Window.setinterval ("Move_right ()", 20));
} else if (count = 1) {
Count = 5;
Banner.style.marginLeft = -2000 + "px";
count++;
Arr.push (Window.setinterval ("Move_left ()", 20));
}
}
function Move_left () {
if (Banner.offsetleft = = (count-1) * (-400)) {
Clear ();
} else {
Banner.style.marginLeft = banner.offsetleft-20 + "px";
}
}
function Move_right () {
if (Banner.offsetleft = = (count-1) * (-400)) {
Clear ();
} else {
Banner.style.marginLeft = Banner.offsetleft + + "px";
}
}
function Clear () {
for (var x in arr) {
Window.clearinterval (Arr[x]);
}
}
-----------------------------Split Line--------------------------------
</script>
<!--0-500-1000-1500 X
1 0 2 3 4 n-->
Big Picture Carousel JS