Need quick JS help.

Discussion in 'JavaScript' started by TrafficRider, Nov 21, 2011.

  1. #1
    I have this js code to click certain part of the page on page load. It works alright but I want it to delay X number of seconds before event occurs.

    onload="$('ul.galleria li:last img').trigger('click');
    Code (markup):
    Please advice. Thanks.
     
    Solved! View solution.
    TrafficRider, Nov 21, 2011 IP
  2. #2
    gtownfunk, Nov 21, 2011 IP
  3. TrafficRider

    TrafficRider Active Member

    Messages:
    250
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Yep that's what I did. Thank you for the link.
     
    TrafficRider, Nov 22, 2011 IP
  4. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #4
    
    <!-- 5000 means 5 seconds -->
    <body onload="setTimeout(function(){$('ul.galleria li:last img').trigger('click');},5000);">
    
    HTML:
     
    JohnnySchultz, Nov 23, 2011 IP