亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery UI實現(xiàn)動畫效果代碼分享

 更新時間:2018年08月19日 11:04:37   作者:耳火耳火  
這篇文章給大家總結(jié)了jQuery UI實現(xiàn)動畫效果的實例代碼,有需要的朋友們可以參考測試下。

頁面文檔載入后,為第一張圖片添加class屬性值為img1,為第二張圖片添加class屬性值img2,為第三張圖片添加class屬性img3,為第四張圖片添加class屬性值img4,這會使得每張圖片的下半部分被上一張更大的圖片給覆蓋住。

當(dāng)鼠標(biāo)單擊暴露在最上面的圖片時,該圖片在0.6秒內(nèi)從原本大小放大150%,并逐漸減小不透明度直到完全消失,與此同時,其他所有圖片在0.6秒內(nèi)動態(tài)的放大并占據(jù)相應(yīng)上一張圖片的位置。全部動態(tài)效果結(jié)束后,消失不見的那張圖片重新顯示在最下面。

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>jQuery UI</title>
	<style type="text/css">
		div{
			position: relative;
		}
		img{
			position: absolute;
			border:solid 3px black;
		}
		.img1{
			width: 300px;
			height: 220px;
			top:120px;
			left: 200px;
			z-index: 4;
			opacity:1;
			cursor:pointer;
		}
		.img2{
			width: 200px;
			height: 145px;
			top:85px;
			left: 250px;
			z-index: 3;
			opacity: 0.7;
		}
		.img3{
			width: 120px;
			height: 90px;
			top:60px;
			left: 290px;
			z-index: 2;
			opacity: 0.5;
		}
		.img4{
			width: 60px;
			height: 55px;
			top:45px;
			left: 320px;
			z-index: 1;
			opacity: 0.4;
		}
	</style>
	<script type="text/javascript" src="jquery-1.5.2.min.js"></script>
	<script type="text/javascript" src="jquery.effects.core.min.js"></script>
	<script type="text/javascript" src="jquery.effects.scale.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('img').each(function(index){
				$(this).addClass('img'+(index+1));
			});
			$('img.img1').live('click',function(){
				$(this).hide('puff',{percent:150},600,function(){
					$(this).attr('class','img4').show();
				});
				$('img.img2').switchClass('img2','img1',600);
				$('img.img3').switchClass('img3','img2',600);
				$('img.img4').switchClass('img4','img3',600);
			});
		});
	</script>
</head>
<body>
	<div>
		<img src="1.jpg">
		<img src="2.jpg">
		<img src="3.jpg">
		<img src="4.jpg">
	</div>
</body>
</html>

初始效果:

點擊后效果:

相關(guān)文章

最新評論