The effect of fly-in picture slide transition based on jquery character

Source: Internet
Author: User

Let's look at the picture of the slideshow of the fly-through pictures.

CSS Code

The code is as follows Copy Code

<style type= "Text/css" >
*{margin:0;padding:0;}
Body{color: #333; font-size:12px;font-family:verdana,arial,helvetica,sans-serif;}
img{border:0;}
Ol,ul,li{list-style:none;}
A{text-decoration:none;color: #333;}
A:hover{text-decoration:underline;}
. Focus{width:600px;height:250px;background: #eee; margin:10px Auto;position:relative;overflow:hidden;}
. Focus ul{}
. focus Li{width:550px;height:200px;padding:25px;position:absolute;left:600px;top:0;}
. Focus Li H5,.focus li P,.focus li a.button{float:left;position:relative;
. Focus Li h5{width:300px;font-size:22px;font-family: "Microsoft Yahei";}
. Focus Li P{width:300px;line-height:22px;font-size:14px;margin:1em 0;
. Focus Li A.button{width:100px;height:30px;background: #333; cursor:pointer;display:none;}
. Focus Li A.button:hover{background: #666;}
. Focus Li Div.imgbox{float:right;width:200px;height:200px;position:relative;background: #f00;}
. Focus Li Div.imgbox img{}
. focus. btn{position:absolute;width:600px;height:6px;padding:10px;text-align:center;left:0;bottom:0;}
. focus. BTN Span{display:inline-block;width:10px;height:6px;background: #999; margin:0 3px;}
. focus. BTN Span.on{background: #000;}
</style>

JavaScript code

The code is as follows Copy Code

<script type= "Text/javascript" src= "/effect/images/20127/141615/jquery-1.6.2.min.js" ></script>
<script type= "Text/javascript" >
$ (function () {
var len = $ (". Focus ul Li"). length;
var width = 600; Overall width, based on this calculation offset
var indent = 50; A short length of time to go back when the title is hidden
var index = 0;
var Pictimer;
var btn = "<div class= ' btn ' >";
for (var i = 0; i < len; i++) {
BTN = "<span></span>";
}
BTN = "</div>";
$ (". Focus"). Append (BTN);
$ (". Focus. BTN span"). MouseEnter (function () {
Index = $ ('. focus. BTN span '). Index ($ (this));
Play (index);
). EQ (0). Trigger ("MouseEnter");
$ (". Focus"). Hover (function () {
Clearinterval (Pictimer);
},function () {
Pictimer = setinterval (function () {
index++;
if (index = = len) {index = 0;}
Play (index);
},5000);
}). Trigger ("MouseLeave");
Function Play (index) {
var $now = $ (". Focus ul Li.on");
if ($now. length > 0) {
$now. Find ("H5"). Stop (True,true). Animate ({left: "-" + (width-indent) + "px"},400,function () {
$ (this). Animate ({left: "-" + (2*width) + "px"},400);
});
$now. Find ("A.button"). Stop (True,true). Fadeto (400,0);
var hidedelay = settimeout (function () {
$now. Find ("P"). Stop (True,true). Animate ({left:-"+ (width-indent) +" px "},400,function () {
$ (this). Animate ({left: "-" + (2*width) + "px"},400);
$now. Find ("Div.imgbox"). Stop (True,true). Animate ({left: "-" + (2*width) + "px"},400);
});
},200);
var Showdelaya = settimeout (function () {
Show (index);
},700);
} else {
Show (index);
}
}
Function Show (index) {
var $next = $ (". Focus ul Li")-eq (index);
$next. Find ("H5"). CSS ({left: "0px"});
$next. Find ("P"). CSS ({left: "0px"});
$next. Find ("A.button"). CSS ({left: "0px"});
$next. Find ("Div.imgbox"). CSS ({left: "0px"});
$next. Find ("H5"). Stop (True,true). Animate ({left: "-" + width + "px"},400);
var Showdelayb = settimeout (function () {
$next. Find ("Div.imgbox"). Stop (True,true). Animate ({left: "-" + width + "px"},300);
$next. Find ("P"). Stop (True,true). Animate ({left: "-" + width + "px"},300,function ()) {
$next. Find ("A.button"). Stop (True,true). Animate ({left: "-" + width + "px"},300,function () {$ (this). Fadeto (400,1);});
});
},300);
$ (". Focus. BTN span"). Removeclass (' on '). EQ (index). addclass ("on");
$ (". Focus ul Li"). Removeclass (' on '). EQ (index). addclass ("on");
}
});
</script>

HTML code

The code is as follows Copy Code

<div class= "Focus" >
<ul>
<li class= "Clearfix" >
<div class= "Imgbox" ></div>
<p> a professional platform focused on high-quality Web templates, website source code and design material resource sharing, mainly provide the high quality material resources such as webpage template, website template, commercial website source code, graphic design material, 3D three-dimensional design material, film material and so on. <p>
</li>
<li class= "Clearfix" >
<div class= "Imgbox" ></div>
<p> Web site Special effects provided by the establishment of the common JS special effects code demo and download. <p>
<a class= "button" >Download</a>
</li>
<li class= "Clearfix" >
<div class= "Imgbox" ></div>
<p> provides a variety of commonly used advertising code, you are welcome to download the use of webmaster, thank you for your support! </p>
<a class= "button" >Download</a>
</li>
</ul>
</div>

We can just combine the three pieces of code together to quickly achieve the magic version you want.

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.