首页 技术 正文
技术 2022年11月23日
0 收藏 920 点赞 4,366 浏览 1877 个字
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<title>左右点击幻灯片</title>
<style type="text/css">
*{margin: 0;padding: 0;}
ul{ list-style: none;}
.wrapper{width: 300px;height: 200px; margin:100px auto;overflow: hidden;border: 2px solid #ccc;position: relative;}
.scroll{width: 205px;margin: 0 auto; overflow: hidden;}
.scroll li{float: left; margin: 5px; height:160px; font-size:60px; text-align:center; line-height:100px; font-weight:800; background:#FF3F00; color:#fff; width:200px;}
.prev,.next{ width: 30px;height: 30px;background: #daa520;color: #fff;cursor: pointer;position: absolute;top:80px; text-align: center;line-height: 30px;}
.next{ right: 0;}
</style>
</head>
<script>
$(function(){
var oScroll=$('.scroll>ul'),oLi=oScroll.find('li'),oLen=oLi.length,oPrev=$('.prev'),oNext=$('.next'),oWidth=oLi.eq(0).outerWidth(true),iNow= 1,oCur=$('.count>em'),oCount=$('.count>i'),iTimer=null;
oScroll.width(oWidth*oLen);
oCount.html(oLen);
function count(){
oCur.html(iNow);
}
function Prev(){
oScroll.css({marginLeft:-oWidth+'px'}).find('li:last').prependTo(oScroll);
oScroll.stop(true,true).animate({marginLeft:0+'px'},600);
iNow=iNow>1?iNow-1:oLen;
count(iNow);
}
function Next(){
oScroll.stop(true,true).animate({marginLeft:-oWidth+'px'},600,function(){
oScroll.css({marginLeft:0}).find('li:first').appendTo(oScroll);
})
iNow=iNow<oLen?iNow+1:1;
count(iNow);
}
oPrev.bind('click',Prev);
oNext.bind('click',Next);
iTimer=setInterval(Next,3000);
$('.wrapper').hover(function(){
clearInterval(iTimer);
},function(){
iTimer=setInterval(Next,3000);
})
})
</script>
<body>
<div class="wrapper">
<span class="prev">《</span>
<span class="next">》</span>
<div class="scroll">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</div>
<div class="count"><em>1</em>/<i>0</i></div>
</div>
</body>
</html>
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,022
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,359
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,142
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,773
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,851