Is it possible to stop a hidden div loading until it is revealed?

Discussion in 'JavaScript' started by another, Apr 4, 2010.

  1. #1
    Is it possible to have content in a hidden div that doesn't load until it is revealed? I have a page with content that is hidden until the correct link is clicked. This is a tidy solution, aesthetically, but I worry about the page load times. Is there any way to "pause" the div's loading until it is made visible by the link?
    Thanks a lot.
     
    another, Apr 4, 2010 IP
  2. thecancerus

    thecancerus Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can load your content via ajax..
     
    thecancerus, Apr 7, 2010 IP
  3. hdewantara

    hdewantara Well-Known Member

    Messages:
    540
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #3
    One way would be using window.setTimeout() if the right link is clicked.

    That timer would then call document.createElement() to create a new div element.

    Set this element visibility to hidden first, before adding it to the structure by calling element.appendChild().

    Now you have it in the document structure as a child,
    show it using visibility = "visible".

    Tell me if this works in your system :)
    Hendra.
     
    hdewantara, Apr 11, 2010 IP