Created
January 26, 2012 23:22
-
-
Save scopevale/1685795 to your computer and use it in GitHub Desktop.
jsFiddle demo - jQuery delay()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div { position: absolute; width: 60px; height: 60px; float: left; top: 30px; } | |
.first { background-color: #3f3; left: 0; } | |
.second { background-color: #33f; left: 80px; } | |
.third { background-color: #f33; left: 0; top: 135px; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p><button id="button1">Run 1</button></p> | |
<div class="first"></div> | |
<div class="second"></div> | |
<br/><br/><br/><br/> | |
<p><button id="button2">Run 2</button></p> | |
<div class="third"></div> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.noConflict(); | |
jQuery(document).ready(function($) { | |
$('#button1').click(function() { | |
$('div.first').slideUp(300).delay(4000).fadeIn(400); | |
$('div.second').delay(3000).slideUp(300).delay(3000).fadeIn(400); | |
}); | |
$('#button2').click(function() { | |
$('div.third').delay(10000).hide(); | |
$(alert('done')).delay(10000); | |
}); | |
// $.when({ | |
// testing: 123 | |
// }).done( | |
// function(x) { | |
// alert(x.testing); | |
// } /* alerts "123" */ ); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: jsFiddle/Gist demo - setTimeout | |
description: jsFiddle demo hosted on Gist | |
authors: | |
- Gary Smith | |
title: | |
- JS Fiddle - jsFiddle/Gist integration demo - setTimeout | |
resources: | |
- /js/empty.js | |
normalize_css: yes | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://jsfiddle.net/gh/gist/jquery/edge/1685795/