Simple onLoad Question

Discussion in 'JavaScript' started by jrp1, Jun 29, 2009.

  1. #1
    Hey everyone,

    I currently have a jQuery scrolling plugin to scroll to a certain point on the page to execute onload. Here's the code:

    <body onLoad="if($.browser.opera){$('html').animate({scrollTop: $('#div').offset().top}, 2000);} else $('html,body').animate({scrollTop: $('#div').offset().top}, 2000);>
    Code (markup):
    The only problem with this is onload executes after all my content is loaded, and I have a sizeable amount of flash and images that all have to load first in order for the page to start scrolling.

    Is there any way to have this code execute first in <script> tags or something?
     
    jrp1, Jun 29, 2009 IP
  2. Goramba

    Goramba Peon

    Messages:
    128
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    should be able to just put it in script tags just under the body tag. It'll run top down.
     
    Goramba, Jun 29, 2009 IP
  3. jrp1

    jrp1 Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Well that didn't work, lol :) any other ideas??
     
    jrp1, Jun 29, 2009 IP
  4. jrp1

    jrp1 Active Member

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53