zoukankan      html  css  js  c++  java
  • jqeury轮播

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Examples</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link href="" rel="stylesheet">
    <script src="http://cdn.bootcss.com/jquery/1.7.2/jquery.min.js"></script>
    <style type="text/css">
    	*{padding: 0px;margin:0px;}
    	.x{margin:30px 30px;text-align: center;}
    	.box,.nav-menu{position: relative;}
    	.box{ 1024px;height: 264px;overflow: hidden;zoom: 1;margin:10px auto;}
    	.box ul li{ 100%;
    	 position:absolute;
    	 height:298px;
    	 float:left;
    	overflow:hidden;}
    	ul li{list-style: none;}
    	.nav-menu{left: 950px;bottom: 25px;}
    	.nav-menu ul li{float: left;background-color: black;color:#fff;margin-left: 1px;20px;height: 20px;}
    	.nav-menu .m{color: red;  25px;height: 25px;line-height: 24px;margin-top:-3px; border-radius: 25px;}
    </style>
    <script type="text/javascript">
    	$(function(){
    		var swidth=$('.box').width();
    		var len=$('.box ul li').length;
    		var times;
    		var index=0;
    		$('.nav-menu ul li').click(function(){
    			$(this).addClass('m').siblings('li').removeClass('m');
    			var index=$(this).index();
    			show(index);
    			
    		})
    		$('.box ul').css('width',swidth*(len));
    		$('.box').hover(function(){
    			clearInterval(times);
    		},function(){
    			times=setInterval(function(){
    				show(index);
    				index++;
    				if(index==len){index=0}		
    			},2000)
    		})
    
    		function show(index){
    			var lef=-index*swidth;
    			//$('.box ul li').stop(true,false).animate({left:lef},1000);
    			$('.box ul li').eq(index).fadeIn('slow').siblings('li').fadeOut('slow');
    			$('.nav-menu ul li').removeClass('m').eq(index).addClass('m');
    		}
    		
    
    	})
    </script>
    </head>
    <body>
          <div class="x">
        	<div class="box">
        		<ul>
        			<li><img src="1.jpg" /></li>
        			<li><img src="2.jpg" /></li>
        			<li><img src="3.jpg" /></li>
        		</ul>
        	</div>
        	<div class="nav-menu">
        		<ul>
        			<li class='m'>1</li>
        			<li>2</li>
        			<li>3</li>
        		</ul>
        	</div>
        </div>
    </body>
    </html>
    

      

  • 相关阅读:
    区间DP中的环形DP
    hdu 5251 包围点集最小矩形 ***
    hdu 4858 水题
    hdu 3530 单调队列 **
    hdu 3338 最大流 ****
    hdu 2732 最大流 **
    hdu 5233 离散化 **
    hdu 3555 数位dp *
    zoj 3469 区间dp **
    2015 安徽程序设计省赛总结
  • 原文地址:https://www.cnblogs.com/mengluo/p/5956660.html
Copyright © 2011-2022 走看看