each()的用法

<!doctype html>
<html>
<head>
<title>each()的用法</title>
<meta charset="utf-8">
<style type="text/css">  
            * {padding:0px; margin:0px;}  
            .roll {width:580px;height:290px;position:relative;overflow:hidden;}  
            .roll_num li.roll_num_hover {background:#dc282b;color:#fff;}  
            .roll_pic{ position:absolute;top:0;left:0; height:290px;width:580px;}  
	
            .roll_num {position:absolute;bottom:25px;margin-right:5px;float:right;z-index:10;}  
            .roll_num li {list-style:none;float:left;font-size:12px;font-weight:600;width:18px;height:18px;line-height:18px;cursor:pointer;margin:0 3px;text-align:center;color:#dc282b;background:#fff;-moz-border-radius:8px;border-radius:8px;}  
          
        </style>  
<script type="text/javascript" src="http://jt.875.cn/js/jquery.js"></script>
</head>
<body>
<div class="roll">  
            <div class="roll_pic">  
                <a href="http://www.875.cn/" target="_blank"><img src="http://pic.875.cn/upload/2013-05-22/1751132091.jpg"></a>  
                <a href="http://www.875.cn/" target="_blank"><img src="http://pic.875.cn/upload/2013-03-26/1504517406.jpg" ></a>  
                <a href="http://www.875.cn/" target="_blank"><img src="http://pic.875.cn/upload/2013-04-12/1003432197.jpg"></a>  
            </div>  
              
            <div class="roll_num">  
                <ul>  
                    <li class="roll_num_hover">1</li>  
                    <li>2</li>  
                    <li>3</li>  
                </ul>  
            </div>  
			<script type="text/javascript">
				$(function(){
						$(".roll_num li ").each(function(i){
							$(this).mouseover(function(){
							$(".roll_pic img").hide();
							$(".roll_pic img").eq(i).show();
							$(this).addClass("roll_num_hover").siblings().removeClass("roll_num_hover");
							});
						});				
					});
			</script>

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值