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>
    

      

  • 相关阅读:
    eclipse使用svn
    yum安装mysql
    spring中aop使用
    mybatis定义拦截器
    横扫页面的三大标签
    springmvc日期格式化
    springmvc笔记
    springboot跳转jsp页面
    常用网址
    CentOS Android Studio桌面图标的创建
  • 原文地址:https://www.cnblogs.com/handsomehan/p/5621852.html
Copyright © 2011-2022 走看看