码迷,mamicode.com
首页 > 其他好文 > 详细

简单的图片翻页

时间:2014-10-24 10:33:04      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   sp   div   on   

 1 function animatePic(){
 2                 var box=$(".list-img");
 3                 var item=box.find(".item-img");
 4                 var left;
 5                 var len=item.length;
 6                 var _w=item.width();
 7                 var w=_w*len;
 8                 var num=2;
 9                 $(".list-img").width(_w*len);
10                 $(".next").click(function(){
11                     left=box.position().left;
12                     if(left<=(w-_w*num)*-1) return false;
13                     if(!box.is(":animated")){
14                         box.animate({left:"-="+_w},500);
15                     }
16                 });
17                 $(".prev").click(function(){
18                     left=box.position().left;
19                     if(left>=0) return false;
20                     if(!box.is(":animated")){
21                         box.animate({left:"+="+_w},500);
22                     }
23                 });
24                 $(".box-img .item-img").click(function(){
25                     var src = $(this).find("img").attr("src");
26                     $("img.left-img").attr("src", src);
27                 });
28             }

 

简单的图片翻页

标签:style   blog   color   io   os   ar   sp   div   on   

原文地址:http://www.cnblogs.com/lihui1030/p/4047551.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!