그림 상하 전환 효과

2637 단어 그림.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>  jQuery         (     )</title>
<link rel="stylesheet" href="http://mrthink.net/demo/css/base.css" />
<link rel="shortcut icon" type="image/x-icon" href="http://mrthink.net/wp-content/themes/zsofa/favicon.ico" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<style>
/*demo css*/
#demo h2{background:#a40000; font-size:12px; color:#fff; font-weight:normal; text-align:center; width:100px; height:25px;line-height:25px; margin:30px 0 0 20px}
#demo ul{width:800px; height:300px; background:#eee; overflow:hidden;margin-bottom:20px;border:2px solid #a40000}
#demo li{height:30px;text-indent:15px; font-size:12px; line-height:30px;list-style:none}
#demo {height:300px;overflow:hidden;}
</style>
<script>
$(function(){
	//    @Mr.Think
	var _wrap=$("#demo");//      
	var _interval=1000;//        
	var _moving;//       
	_wrap.hover(function(){
		clearInterval(_moving);//          ,    
	},function(){
		_moving=setInterval(function(){
			var _field=_wrap.find('ul:first');//             ,li:first      
			var _h=_field.height();//        
			_field.animate({marginTop:-_h+'px'},600,function(){//    margin ,     
				_field.css('marginTop',0).appendTo(_wrap);//   ,    margin   ,      ,      
			})
		},_interval)//         _interval
	}).trigger('mouseleave');//     ,    mouseleave,     
});
</script>
</head>
<body>

<div id="demo">
	<ul style=" width:800px; height:400px;">
		<li style="float:left;"><img  src="imgs/index_2.png"></li>
		<li style=" float:left;"><img  src="imgs/index-3.png"></li>
	</ul>
	<ul style=" width:800px; height:400px;">
		<li style="float:left;"><img src="imgs/index_2.png"></li>
		<li style="float:left;"><img  src="imgs/index-3.png"></li>
	</ul>
</div>

</body>
</html>

좋은 웹페이지 즐겨찾기