Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2012
    Posts
    137
    Thanks
    1
    Thanked 1 Time in 1 Post

    How can I preload HTML content to an invisible div

    Hello,

    I have what I call a hub page which loads only once. Then I use JS/jQuery (I know, same thing) to load the html content to a div. When the user clicks the next button new content is displayed.

    So, I am wondering how I would go about preloading the html content for the next page to an invisible or "off the screen" div. Then when the user clicks the 'next' button, the preloaded content would be loaded to the active div and the invisible div would preload the next page, and so on.

    This sounds a bit easier now that I have thought it through.

    Any advice here?

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    JS/jQuery are not the same. jQuery is a library that runs under JS.

    Yeah, you can load as many hidden divs as you like, all preloaded with content, then use buttons to "paste" the HTML content of any hidden div into the visible div. If you're using jQuery, the .html() will do it.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,918
    Thanks
    56
    Thanked 546 Times in 543 Posts
    ... or just hide() and show() divs as required

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,296
    Thanks
    10
    Thanked 584 Times in 565 Posts
    it would be better to store it in a var instead of as a hidden dom element. The more stuff in the dom, the slower the page renders and scrolls...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

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