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
  • 26,950
  • 9
  • 73
  • 75
zadubz
  • 1,223
  • 2
  • 19
  • 34
  • 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,759
  • 2
  • 29
  • 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
  • 21,608
  • 17
  • 100
  • 173
  • 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
  • 98,395
  • 62
  • 265
  • 345
  • 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