层级轮播图(animate)
2024-09-05 19:48:10
层级轮播图(animate)
css
<style type="text/css">
* {
margin: 0;
padding: 0;
} ul, ol {
list-style: none;
} .wrap {
width: 650px;
height: 250px;
margin: 100px auto 0;
position: relative;
overflow: hidden;
} .wrap img {
display: block;
} .wrap ul {
height: 250px;
z-index: 1;
position: relative;
} .wrap ol {
height: 30px;
z-index: 2;
position: absolute;
bottom: 0;
right: 0;
} .wrap > ul > li {
position: absolute;
top: 0;
left: 650px;
} .wrap > ol > li {
float: left;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
border: 1px solid white;
margin-right: 5px;
background: Gray;
} .wrap > ol > li:hover {
cursor: pointer;
} .wrap li.active {
padding: 2px;
color: orange;
margin-top: -4px;
border: 1px solid orange;
}
</style>
html、js
<div class="wrap">
<ul>
<li style="z-index:0;left:0;"><img src="data:images/01.jpg" alt=""/></li>
<li><img src="data:images/02.jpg" alt=""/></li>
<li><img src="data:images/03.jpg" alt=""/></li>
<li><img src="data:images/04.jpg" alt=""/></li>
<li><img src="data:images/05.jpg" alt=""/></li>
</ul>
<ol>
<li class="active">1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ol>
</div> <script type="text/javascript">
var timer = null;
var index = 0;
var $olist = $("ol li");
var $ulist = $("ul li");
timer = setInterval( autoPlay , 3000 );
function autoPlay(){
index++;
if( index == $olist.size() ){
index = 0;
}
$olist.eq(index).addClass("active").siblings().removeClass("active");
$ulist.eq(index).animate({"left":0},1500,function(){
//当前运动的图片达到目标值后 将其余所有的图片恢复到left:650位置
$(this).css("zIndex",0).siblings().css({"left":650,"zIndex":1})
})
}
</script>
最新文章
- ubuntu的使用
- MySQL 性能优化的最佳20多条经验分享
- python-学习笔记1-面向对象编程
- RT-Thread的CPU使用率计算
- ASP.NET MVC 基础(01)
- Web开发之tomcat配置及使用(环境变量设置及测试,一个简单的web应用实例)
- JavaScript高级之闭包的概念及其应用
- PDF数据防扩散系统方案
- 实验测试之------创建DBlink,查询远端的yang用户下的abcdedfa表,创建同义词
- SQLSERVER2012的分页新功能
- [Swift]LeetCode144. 二叉树的前序遍历 | Binary Tree Preorder Traversal
- RoR - Restful Actions
- 2018-6-21-随笔-WEB应用程序
- Long类型转json时前端js丢失精度解决方案
- 20145317彭垚《网络对抗》Exp2 后门原理与实践
- hdoj1069 Monkey and Banana(DP--LIS)
- 生成xml文件的步骤 -- XML的序列化器
- CVE-2010-3974 Microsoft Windows多个平台Fax Cover Page Editor内存破坏漏洞
- Mac appium iOS 安装命令
- Linux的内存映像导出接口—kcore
热门文章
- JAVA开发几个常用快捷键
- 编译出错:must be index or base register
- JavaScript-----8.数组
- jxl.jar下载
- 关于VAD的两种内存隐藏方式
- .Netcore Swagger - 解决外部库导致的“Actions require an explicit HttpMethod binding for Swagger 2.0”
- golang中,new和make的区别
- Ext.ux.UploadDialog上传大文件 HTTP 错误 413.1 - Request Entity Too Large Web 服务器拒绝为请求提供服务,因为该请求实体过大。Web 服务器无法为请求提供服务,因为它正尝试与客户证书进行协商,但请求实体过大。
- Java面试基础 -- Git篇
- PostgreSQL update set from 两表联合更新,注意与其它数据库更新语法有差别