0
votes

I want to toggle slide for a div after a delay (let's say 3 seconds). I have a JSFiddle of my code so far where div1 and div2 don't delay. The current functionality I have implemented is on click (see div3 and div4).

JS:

var $div1 = $('#div1'), $div2 = $('#div2'), currentDiv = 'div1', $b1 = $('#b1');

$div2.hide();
$b1.text('In ' + currentDiv);
$(document).ready(function(){
    $div1.delay(3000).toggle('slide', {direction: 'right'}, 'slow');
    $div2.delay(1000).toggle('slide', {direction: 'left'}, 'slow');  
});
1
I don't understand the problem, your code above works for me: jsfiddle.net/Lvz8ddh8/3 - Saar
@Saar I think I realized where I messed up. It was the positioning of the delays. thanks for the fiddle, it helped! - Andy

1 Answers

0
votes

Please see my fiddle: http://jsfiddle.net/Lvz8ddh8/3/

$(document).ready(function(){
    $div1.delay(3000).toggle('slide', {direction: 'right'}, 'slow');
    $div2.delay(3000).toggle('slide', {direction: 'left'}, 'slow');
});