Big Picture Carousel JS

Source: Internet
Author: User

<! 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.