/    Sign up×
Community /Pin to ProfileBookmark

Need a delay for 2 Seconds ….


I am trying to create a delay in my script that stops curtains from opening for about 2 seconds when the Christmas ball is pressed. This is to allow enough time to load content into an iframe that are hidden behind the curtains.

The script is based on Sam Dunn’s tutorial ‘Animate Curtains Opening with jQuery’ ( [url]http://buildinternet.com/2009/07/animate-curtains-opening-with-jquery/[/url] )

Here is Sam’s Script:


Animate a Curtain Opening with jQuery
By Sam Dunn
2009 Build Internet! [url]www.buildinternet.com[/url]

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″/>
<title>Animate a Curtain Opening with jQuery | Build Internet</title>
<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”>
$(document).ready(function() {

$curtainopen = false;

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;
$(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;

<style type=”text/css”>
body {
text-align: center;
background: #4f3722 url(‘images/darkcurtain.jpg’) repeat-x;
border: none;
width: 50%;
height: 495px;
top: 0px;
left: 0px;
position: absolute;
z-index: 2;
width: 51%;
height: 495px;
right: 0px;
top: 0px;
position: absolute;
z-index: 3;
.rightcurtain img, .leftcurtain img{
width: 100%;
height: 100%;
margin: 0px auto;
margin-top: 150px;
position: absolute;
top: -40px;
left: 70%;
z-index: 4;



<div class=”leftcurtain”><img src=”images/frontcurtain.jpg”/></div>
<div class=”rightcurtain”><img src=”images/frontcurtain.jpg”/></div>
<img class=”logo” src=”images/buildinter.png”/>
<a class=”rope” href=”#”>
<img src=”images/rope.png”/>


Any help will be much apriciated.



to post a comment

0Be the first to comment 😎



Help @jetpat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,