Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-16-2013, 10:06 PM   PM User | #1
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 128
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
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?
m2244 is offline   Reply With Quote
Old 01-16-2013, 10:26 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 945
Thanks: 7
Thanked 97 Times in 97 Posts
WolfShade is an unknown quantity at this point
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".
WolfShade is offline   Reply With Quote
Old 01-16-2013, 10:28 PM   PM User | #3
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 453 Times in 451 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
... or just hide() and show() divs as required
xelawho is offline   Reply With Quote
Old 01-17-2013, 12:32 AM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,454
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:27 AM.


Advertisement
Log in to turn off these ads.