Html+css+javascript Web Albums "thumbnail"

Source: Internet
Author: User
Tags setinterval

Finishing a bit tonight, the class album to get a bit, add a thumbnail, version is a bit ugly, the next version of the update it.

1

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> Big Fat </title>
<style type= "Text/css" >
div{margin:0px Auto;}
. box{width:800px;height:530px;overflow:hidden;border-radius:10px;}
. thum{height:200px;width:1500px;margin-top:50px;}
ul{list-style:none;margin:0px;padding:0px;}
Li{float:left;}
. Thumbs_none{opacity:0.6;filter:alpha (opacity=40);}

</style>

<script type= "Text/javascript" >
Define a variable to control the global timer
var times;

Window.onload=function () {
Controlling Timers with variables
Times = setinterval (' lb () ', 1000);
}

Picture Carousel Method
var i=2;
function lb () {
Get src attribute Change picture path
var info = document.getElementById ("img");
var Thu=document.getelementbyid ("thumbs");

var li_list=document.getelementsbytagname ("Li");
for (var j = 1; j<li_list.length;j++) {
Add transparent styles to all thumbnails
Li_list[j].classname= "Thumbs_none";
Match thumbnail sync remove transparency
if (j==i) {
Li_list[j].classname= "";
}
}

Remove transparency Style
Thu.classname= "";
Info.src= "./" +i+ ". JPG ";
Return to zero when i+1 reaches maximum number after operation
i++;
if (i>23) {
I=1;
}
}

Mouse over stop
function Stop () {
Cleaning timers
Clearinterval (times);
}

Mouse left to continue carousel
function again () {
When you clear the timer, you need to clear this too. Otherwise two runs will overlap
Times = setinterval (' lb () ', 1000);
}
</script>
<body>
<div class= "box" >
<ul><li></li> </ Ul> </div>

<div class= "Thum" >
<ul class= "TBS" >
<!--here is no use JS temporarily do not write the next version and then improve-
<li class= "" > </li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>
<li class= "Thumbs_none" ></li>


</ul>
</div>
</body>

As follows:

Online Demo Address: http://bbqwifi.info/php/show/But there seems to be a bit of delay after uploading pictures, so don't mind.

Html+css+javascript Web Albums "thumbnail"

Related Article

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.