zoukankan      html  css  js  c++  java
  • 无缝轮播图

    <!DOCTYPE html>
    <html lang="zh-cn">
    <head>
    	<meta charset="UTF-8">
    	<!-- 网页文档三要素 -->
    	<meta name="Keywords" content="">
    	<meta name="description" content="">
    	<title>无缝滚动</title>
    	<style>
    		* {
    			margin: 0;
    			padding: 0;
    		}
    		#banner {
    			height: 350px;
    			 1120px;
    			background-color: blue;
    			overflow: hidden;
    			margin: 0 auto;
    			position: relative;/*相对定位,参考物*/
    		}
    		#banner ul.img {
    			 8960px;
    			margin-left: 0px;
    		}
    		#banner ul.img li {
    			height: 350px;
    			 1120px;
    			list-style: none;
    			float: left;
    		}
    		#banner ul.nav {
    			position: absolute;
    			bottom: 10px;/*距离参考物下边的距离*/
    			 140px;
    			left: 490px;/*距离参考物左端的距离*/
    		}
    		#banner ul.nav li {
    			 10px;
    			height: 10px;
    			background: #333;
    			float: left;
    			margin: 3px;
    			list-style: none;
    		}
    		#banner ul.nav li.curr {
    			background: #ff0099;
    		}
    	</style>
    </head>
    <body>
    	<div id="banner"> <!--id名是唯一的-->
    		<ul class="img">
    			<li style="background: blue;"></li>
    			<li style="background: red;"></li>
    			<li style="background: yellow;"></li>
    			<li style="background: pink;"></li>
    			<li style="background: white;"></li>
    			<li style="background: black;"></li>
    			<li style="background: green;"></li>
    			<li style="background: #ccc;"></li>
    		</ul>
    		<ul class="nav">
    			<li class="curr"></li>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    		</ul>
    	</div>
    	<script src="js/jquery-1.12.3.min.js"></script>
    	<script>
    		//alert($);
    		var index = 0;//设置初始序列号;
    		setInterval(function() {//定时器1秒钟之后再次调用动画
    			index ++;
    			if (index > 7) {
    				index = 0;
    			}
    			// index %= 7;
    			$("#banner ul.nav li").eq(index).addClass("curr").siblings().removeClass();
    			//让图片从右往左就行滚动轮播
    			$("#banner ul.img").animate({"margin-left": -1120*index + "px"},-1000);
    		},1000);
    	</script>
    </body>
    </html>
    

      

  • 相关阅读:
    【学相伴】Nginx最新教程通俗易懂-狂神说
    Linux基础知识总结(命令行)
    CentOS7 运维
    Linux 的基础知识回顾(安装vmware) ---- No.1 后面都以Centos8 为例
    Linux sudo权限提升漏洞(CVE-2021-3156)
    Flutter开发指南之理论篇:Dart语法05(单线程模型,事件循环模型,Isolate)
    矩阵的范数
    函数导出在kvm_intel.ko,kvm.ko不共享
    python 调用内部类的两种方法
    python3 字符串方法
  • 原文地址:https://www.cnblogs.com/handsomehan/p/5621852.html
Copyright © 2011-2022 走看看