0
$(function(){
    $('#slides_left').slides({
        generateNextPrev: false,
    play: 5500
    });
});

How can I add a .delay() to the function above so that the starting time for the function is not onload rather to a specified time?

sorry for my noobness in jQuery!

Thanks!

antyrat
  • 27,479
  • 9
  • 75
  • 76
zadubz
  • 1,281
  • 2
  • 21
  • 36
  • 3
    possible duplicate of [Is there some way to introduce a delay in javascript?](http://stackoverflow.com/questions/24849/is-there-some-way-to-introduce-a-delay-in-javascript) – Felix Kling Sep 21 '11 at 09:49

3 Answers3

5

you can use javascript setTimeOut function

setTimeout(functionname, 2000); // replace 2000 with your number of millisecond required for delay.

Call this setTimeout inside onload.

Cheers!!

Rahul Choudhary
  • 3,789
  • 2
  • 30
  • 30
2
$(function(){
    // Start after 3 seconds
    window.setTimeout('doSlide()', 3000);
});

function doSlide(){
    $('#slides_left').slides({
        generateNextPrev: false,
        play: 5500
    });
};

There is also a pause option for slides().

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
  • while its waiting for 3 seconds for the function to load the slide show images are stacked one on top of another. Thanks – zadubz Sep 21 '11 at 11:00
1

Use setTimeout

$(function(){
    setTimeout(function(){
      $('#slides_left').slides({
         generateNextPrev: false,
         play: 5500
      });
    }, 1000);
});
Curtis
  • 101,612
  • 66
  • 270
  • 352
  • while its waiting for 1 second for the function to load the slide show images are stacked one on top of another. Thanks – zadubz Sep 21 '11 at 11:00