jQuery实现的模拟拉开序幕的JS代码

2010-03-02 18:05:43 | 【

此代码内容为拉开帷幕的jquery代码,需要jQuery支持,拉开序幕后可以关闭序幕,非常有意思

查看演示页面 View Demo 查看全部代码 View Code

在网页<head>区添加以下代码

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>
	<script src="jquery.easing.1.3.js" type="text/javascript"></script>  

	<script type="text/javascript">

        /*****************************************************
         *  Share JavaScript (http://www.ShareJS.com)
         * 使用此脚本程序,请保留此声明
         * 获取此脚本以及更多的JavaScript程序,请访问 http://www.ShareJS.com
         ******************************************************/
    
		$(document).ready(function() {
		
			$curtainopen = false;
		
			$(".rope").click(function(){
				$(this).blur();
				if ($curtainopen == false){ 
					$(this).stop().animate({top: '0px' }, {queue:false, duration:350, 

easing:'easeOutBounce'}); 
					$(".leftcurtain").stop().animate({width:'60px'}, 2000 );
					$(".rightcurtain").stop().animate({width:'60px'},2000 );
					$curtainopen = true;
				}else{
					$(this).stop().animate({top: '-40px' }, {queue:false, duration:350, 

easing:'easeOutBounce'}); 
					$(".leftcurtain").stop().animate({width:'50%'}, 2000 );
					$(".rightcurtain").stop().animate({width:'51%'}, 2000 );
					$curtainopen = false;
				}
				return false;
			});
			
		});	
	</script>
	<style type="text/css">
	    *{
	    	margin:0;
	    	padding:0;
	    }
	    body {
	    	text-align: center;
	    	background: #4f3722 url('images/darkcurtain.jpg') repeat-x;
	    }
	    img{
			border: none;
		}
		p{
		margin-bottom:10px;
		color:#FFFFFF;
		}
	    .leftcurtain{
			width: 50%;
			height: 495px;
			top: 0px;
			left: 0px;
			position: absolute;
			z-index: 2;
		}
		 .rightcurtain{
			width: 51%;
			height: 495px;
			right: 0px;
			top: 0px;
			position: absolute;
			z-index: 3;
		}
		.rightcurtain img, .leftcurtain img{
			width: 100%;
			height: 100%;
		}
		.logo{
			margin: 0px auto;
			margin-top: 80px;
		}
		.rope{
			position: absolute;
			top: -40px;
			left: 70%;
			z-index: 4;
		}
	   
	</style>


在网页<body>区添加以下代码
	<div class="leftcurtain"><img src="images/frontcurtain.jpg"/></div>
	<div class="rightcurtain"><img src="images/frontcurtain.jpg"/></div>
	<a class="rope" href="#">
		<img src="images/rope.png"/>
	</a>

下载"jQuery实现的模拟拉开序幕的JS代码"

  • 本地下载
  • 本地下载2

相关资源