SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Show/Hide Script performed at onLoad is visible for a second

    LINK-
    http://jafielden.com/people2.php


    I have loaded DIVs that by default should be hidden as the page loads. The problem is that the content is visible while it is loading and after it has finished loading, the DIVs set themselves as hidden. Is there a way to set this script so that the content is not visible for those first few seconds? Any and all help is appreciated. Thanks!

    Todd Temple
    Todd Temple > T2 Design

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do this with css set the default style for div2 and div 3 to display:none;

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you do not want the div's hidden for users without javascript,
    you can use a script to create a stylesheet in the head, before the body is rendered.
    You can use document write or document.createElement('style').

  4. #4
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use an onDOMReady event instead of the onload. All the libraries offer one, or use Dean Edwards'.

  5. #5
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Buddy Bradley View Post
    Use an onDOMReady event instead of the onload. All the libraries offer one, or use Dean Edwards'.
    Hum. I have no idea what that means, but I will get my Google on and see if I can find an explanation. Thanks for the advice. Is there a clear advantage to using the onDOMReady event instead of the other solutions offered?

    Todd
    Todd Temple > T2 Design


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
  •