
Untitled
By: a guest on
Jul 22nd, 2012 | syntax:
None | size: 1.35 KB | hits: 16 | expires: Never
Removing elements and then adding them again
<div id="content">
<div class="tile"></div>
<div class="tile"></div>
<div class="tile"></div>
</div>
$(".tile").fadeOut( showTileSpeed, function() {
$(this).remove();
});
tiles[tileIndex]();// function adding .tiles to my #content
$(".tile").first().fadeIn(showTileSpeed, function showNext() {
$(this).next(".tile").fadeIn(showTileSpeed, showNext);
});
var $tiles = $(".tile").fadeOut(showTileSpeed, function() {
$(this).remove();
});
$.when($tiles).done(function() { // <-- after all animations do this
tiles[tileIndex]();
$(".tile").first().fadeIn(showTileSpeed, function showNext() {
$(this).next(".tile").fadeIn(showTileSpeed, showNext);
});
});
var $tiles = $(".tile").fadeOut(showTileSpeed);
$.when($tiles).done(function() {
$tiles.remove();
tiles[tileIndex]();
$(".tile").first().fadeIn(showTileSpeed, function showNext() {
$(this).next(".tile").fadeIn(showTileSpeed, showNext);
});
});
$(document).ready(function() {
$(".tile").fadeOut( showTileSpeed, function() {
$(this).remove();
tiles[tileIndex]();// function adding .tiles to my #content
$(".tile").first().fadeIn(showTileSpeed, function showNext() {
$(this).next(".tile").fadeIn(showTileSpeed, showNext);
});
});
});