jquery淡入淡出轮播动画
来源:互联网 发布:减员增效人员优化心得 编辑:程序博客网 时间:2024/05/10 04:53
<!DOCTYPE html>
<html><head lang="en"> <meta charset="UTF-8"> <title></title> <style> /*--公共样式*/ body,h1,h2,h3,h4,h5,h6,dl,dt,dd,ul,ol,li,th,td,p,blockquote,pre,form,fieldset,legend,input,button, textarea,hr,img{margin:0;padding:0;font-size:12px;color:#333;} li{list-style:none} fieldset,img{border:0} a{text-decoration:none} a:hover{text-decoration:none} #mainBox{ width:100%; height:400px; overflow:hidden; margin-top:100px; position:relative; } #imgBox>ul>li{ width:100%; height:400px; position:absolute; } /*这个不是必须,根据自己的图片大小,由于我的图片过大,设margin负值可以去掉不要的边*/ #imgBox ul li>img{ margin-left:-340px; } #toLeft{ position:absolute; left:235px; top:160px; height:68px; width:35px; border:none; display:none; background:url(img/cssSprites.png) no-repeat -626px -68px; } #toLeft:hover{ background:url(img/cssSprites.png) no-repeat -626px -153px; } #toRight{ position:absolute; top:160px; height:68px; width:35px; border:none; background:url(img/cssSprites.png) no-repeat -669px -68px; right:235px; display:none; } #toRight:hover{ background:url(img/cssSprites.png) no-repeat -669px -153px; } #indexBox{ position:absolute; z-index:1000; top:89%; left:50%; } #indexBox>ul>li{ width:10px; height:10px; border-radius:100%; background:#fff; float:left; margin-left:10px; margin-top:10px; } #indexBox .showIndex{ background:#E31436; } </style></head><body><div id="mainBox"> <div id="imgBox"> <ul> <li><img src="img/lunbo1.jpg"/></li> <li><img src="img/lunbo2.jpg"/></li> <li><img src="img/lunbo3.jpg"/></li> <li><img src="img/lunbo4.jpg"/></li> </ul> </div> <div id="indexBox"> <ul> <li></li> <li></li> <li></li> <li></li> </ul> </div> <span id="toLeft"></span> <span id="toRight"></span></div><script src="js/jquery-1.11.3.js"></script><script> $("#mainBox").hover(function(){ $("#toLeft,#toRight").show(); },function(){ $("#toLeft,#toRight").hide(); } ) $(function(){ var size=$("#imgBox>ul>li").size(); var imgBox=$("#imgBox>ul>li"); var $indexBox=$("#indexBox>ul li"); var i=0; $("#imgBox>ul li:gt(0)").hide(); $indexBox.eq(0).addClass("showIndex"); $indexBox.on("mouseover",function(){ $(this).addClass("showIndex").siblings().removeClass("showIndex"); var index=$(this).index(); i=index; imgBox.eq(i).fadeIn(1000).siblings().fadeOut(1000); }); function indexLight(){ $indexBox.eq(i).addClass("showIndex").siblings().removeClass("showIndex"); }; function goToLeft(){ i--; if(i==-1){ i=size-1; } imgBox.eq(i).fadeIn(1000).siblings().fadeOut(1000); indexLight(); }; function goToRight(){ i++; if(i==size){ i=0; } imgBox.eq(i).fadeIn(1000).siblings().fadeOut(1000); indexLight(); }; $("#toLeft").click(function(){ goToLeft(); }); $("#toRight").click(function(){ goToRight(); }); var timer=setInterval(goToRight,3000); $("#mainBox").hover(function(){ clearInterval(timer); },function(){ timer=setInterval(goToRight,3000); }) })</script></body></html>
1 0
- jquery淡入淡出轮播动画
- jQuery的动画-淡入淡出
- jQuery动画-淡入和淡出
- JQuery移动 淡入淡出动画
- js淡入淡出轮播
- jquery 实现淡入淡出图片轮播效果
- jquery实现图片轮播_淡入淡出
- jQuery实现图片轮播(淡入淡出效果)
- jQuery 淡入淡出、滑动和动画
- JQuery 动画 滑动卷入 淡入淡出
- jQuery动画---显示、卷动、淡入淡出
- jQuery学习二-简单动画-淡入淡出
- bootstrap 淡入淡出banner轮播
- 淡入淡出背景轮播 jq实现
- bootstrap 淡入淡出banner轮播
- 图片轮播,淡入淡出(js,css)
- JQuery的动画(显示、隐藏、淡出淡入、自定义动画)
- 淡入淡出UIView动画
- Spring 配置文件导入与装配
- Servlet Servlet的路径跳转
- hdu 2044 一只小蜜蜂...
- 一些点
- codeforces100200F——Think Positive
- jquery淡入淡出轮播动画
- CSerialPort串口类最新修正版2016-08-02
- 单链表的基本操作
- x的n次方
- HDU 2054
- const int *p与int *const p的区别
- EditText 基本用法(不弹出软键盘)
- Mysql开放root帐号3306端口
- 二叉排序树中查找效率最高的是