SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2006
    Location
    Washington DC and Skopelos, Greece
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS script works 80% of time

    I have a site that uses a sort of coverflow to display images. The coverflow is a JS implementation.

    A fair amount of time, the script works fine. Other times, it does not. The page loads but the script does not start. Reloading the page usually gets the script to work.

    I think that the script may be trying to start before the page has finished loading.

    Is there a way to delay running the script until I'm sure the page has loaded? That at least would confirm this hypothesis (or not).

    The site is http://beatricehanblett.com/bodies

    Thanks in advance..
    The only way I can repay your help, is to help others.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The link seems to be broken.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2006
    Location
    Washington DC and Skopelos, Greece
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh, I didn't realize I had to spell it exactly ... oops

    http://beatricehamblett.com/bodies


    ... and thanks for replying/looking...


    ps... Then select any of the four images...
    The only way I can repay your help, is to help others.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Of course you have to spell it exactly, otherwise it's a link to somewhere else!

    The problem is not with delaying it, as it's wrapped in a window.onload(), which delays execution until everything has loaded, including all the loads of stylesheets! You have over 30 different CSS files being loaded! This means 30 separate HTTP requests. And each one seems to contain only 1 rule. What's the point of that?

    Once you sort this problem out (combine them into 1 file) then perhaps you'll see the HTTP request for the javascript fail less than 20% of the time (I can't replicate this, it works every time for me). You should also consider combining all the JS into a single file.

    I strongly recommend you look at the advice here.

  5. #5
    SitePoint Zealot
    Join Date
    Jan 2006
    Location
    Washington DC and Skopelos, Greece
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    Of course you have to spell it exactly, otherwise it's a link to somewhere else!
    That was a weak attempt at a joke...

    The problem is not with delaying it, as it's wrapped in a window.onload(), which delays execution until everything has loaded, including all the loads of stylesheets! You have over 30 different CSS files being loaded! This means 30 separate HTTP requests. And each one seems to contain only 1 rule. What's the point of that?
    The point of that is that I use a program called Rapidweaver to create my themes and menues. Their code splits CSS files as you have seen. This is a known issue, and the next release of RW will address that. I could combine the css but as this release is expected shortly, I think I prefer to wait.

    Their are two basic javascripts. One (the contentflow), I have some control over. The other - "highslide.js", I do not.

    I was hoping it would be something simple, but as you note, a) the symptom doesn't happen often b) I would lose out on updates from both the RW community and the highslide community if I go my own way.

    I'm not averse to doing so, but I think I should bide my time.

    Thanks for looking at this.
    The only way I can repay your help, is to help others.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •