jQuery图片九宫格式样布局图片切换-20130623

jQuery图片九宫格样式布局图片切换-20130623
今天的学习

[html5]
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif ,"新宋体";}
/* image_show */
.image_show{width:948px;padding:3px 0 0 3px;border:1px solid #d9d9d9;margin:30px auto}
.image_show .img{padding:0 3px 3px 0;position:relative;}
.image_show .img, .image_show .img img{float:left;}
.col_left{width:191px;float:left;overflow:hidden;}
.col_right{float:left;width:450px;overflow:hidden;}
#bigImg{position:relative;width:304px;height:382px;}
#bigImg .img_mask{position:absolute;left:0;top:340px;width:304px;height:42px;background:#000;opacity:0.6;filter:alpha(opacity=60);}
#bigImg p{position:absolute;left:0;top:340px;width:304px;height:42px;line-height:42px;font-size:16px;text-align:center;color:#fff;}
#bigImg p a, #bigImg p a:visited{color:#fff;}
.mask{position:absolute;left:0;top:0;background:#000;opacity:0.4;filter:alpha(opacity=40);}
.clear{height:0;clear:both;line-height:0;font-size:0;overflow:hidden;}
</style>

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function(){
	
	$('#smallImg img').mouseover(function(){
	/*修改smallImg的ID里面的所有img 背景颜色*/
		$('#bigImg img').attr('src',$(this).attr('rel'));
		/*将出表触碰到的小图片放进大的div里面去通过获得小图片的路径来让大div显示出来*/
		$('#bigImg p > a').text($(this).attr('alt'));
		/*将小图片的链接一同放到大的div里面去*/
		$('#bigImg a').attr('href',$(this).parent().attr('href'));
		/*然后在将链接的路径一同放进去*/	
	});
	
	$('#smallImg .img').hover(function(){
	/*同意设定一个伪类在触发鼠标触碰图片的后触发的效果*/
		$('.mask').fadeIn();
		/*.mask使用淡入效果*/
		$(this).children('.mask').hide();
		/*弹出以后在通过遍历来使得所有的.mask获得隐藏效果*/
	},function(){
		$('.mask').fadeIn();
		/*接着上面的让鼠标一定到新的图片上让新的图片使用淡入效果*/
	});
	
});
</script>

<div class="image_show">

	<div class="img" id="bigImg">
		<a href="http://www.17sucai.com"><img height="382" width="304" alt="量变到质变:寻找你的健康Style" src="images/photo/tk3.jpg"></a>
		<div class="img_mask"></div>
		<p><a href="http://www.17sucai.com">量变到质变:寻找你的健康Style</a></p>
	</div>

	<div id="smallImg">
		<div class="col_left">
			<div class="img">
				<a href="http://www.17sucai.com"><img height="125" width="189" alt="Steinway and Sons Piano Bag 把钢琴背走 " src="images/tk1-1.jpg" rel="images/photo/tk1.jpg"></a>
				<div class="mask" style="width:189px;height:125px;display:block;"></div>
			</div>
			<div class="img">
				<a href="http://www.17sucai.com"><img height="125" width="189" alt="插花老师教你 DIY婚礼花带" src="images/tk2-2.jpg" rel="images/photo/tk2.jpg"></a>
				<div class="mask" style="width:189px;height:125px;display:block;"></div>
			</div>
			<div class="img">
				<a href="http://www.17sucai.com"><img height="125" width="189" alt="量变到质变:寻找你的健康Style" src="images/tk3-3.jpg" rel="images/photo/tk3.jpg"></a>
				<div class="mask" style="width:189px;height:125px;display:none;"></div>
			</div>
		</div>
		
		<div class="col_right">
			<div class="r_top">
				<div class="img">
					<a href="http://www.17sucai.com"><img height="172" width="274" alt="圣诞派对 “鞋”能HOLD住" src="images/tk4-4.jpg" rel="images/photo/tk4.jpg"></a>
					<div class="mask" style="width:274px;height:172px;display:block;"></div>
				</div>
				<div class="img">
					<a href="http://www.17sucai.com"><img height="171" width="169" alt="北海道的风土滋味:北京日料" src="images/tk5-5.jpg" rel="images/photo/tk5.jpg"></a>
					<div class="mask" style="width:169px;height:171px;display:block;"></div>
				</div>
			</div>
			
			<div class="clear"></div>
			
			<div class="r_bottom">
				<div class="img">
					<a href="http://www.17sucai.com"><img height="208" width="147" alt="汪星人来袭 你准备了吗" src="images/tk6-6.jpg" rel="images/photo/tk6.jpg"></a>
					<div class="mask" style="width:147px;height:208px;display:blcok;"></div>
				</div>
				<div class="img">
					<a href="http://www.17sucai.com"><img height="208" width="147" alt="穿针器:懒人刺绣有保证" src="images/tk7-7.jpg" rel="images/photo/tk7.jpg"></a>
					<div class="mask" style="width:147px;height:208px;display:block;"></div>
				</div>
				<div class="img">
					<a href="http://www.17sucai.com"><img height="208" width="147" alt="可爱的圣诞铃铛教你折一个" src="images/tk8-8.jpg" rel="images/photo/tk8.jpg"></a>
					<div class="mask" style="width:147px;height:208px;display:block;"></div>
				</div>
			</div>
		</div>

	</div>
	
	<div class="clear"></div>
	
</div>

</body>
</html>
1 楼 萧远山 1 小时前  
最近的动行效果图呢?怎么只有代码?你完全 不按我们讨论的格式来做啊