javascript - How can I display most of an html page quickly, then load the slow things last? -


i've got jsp page this:

<html><body> <div id="maincontainer">     <div id="firstdisplaystuff">...</div>     <% out.flush(); %>     <div id="slowstuff">         <mytaglib:abc name='slowboat'>...</mytaglib>     </div> </div> <div id="floatrightcontainer>     <div id="endingdisplaystuff">...</div> <div> </body></html> 

when hits taglib, takes forever, , delay can not avoided.

so using out.flush(); can @ least display firstdisplaystuff, user sits there looking @ half page while taglib stuff runs. after that's done user see endingdisplaystuff.

i want firstdisplaystuff , endingdisplaystuff both display right away.

but figured using jquery, there way leave <div id="slowstuff"> blank, , load later.

what jquery code load <div id="slowstuff"> after both display stuff divs showing? put code? how invoked?

edit : added <div id=maincontainer> , <div id=floatrightcontainer> existing example.

you don't need javascript this. place last div before slow one, , use css arrange divs on screen suits you:

<html><body> <div id="firstdisplaystuff">...</div> <div id="endingdisplaystuff">...</div>  <% out.flush(); %> <div id="slowstuff" style="display: none;">     <mytaglib:abc name='slowboat'>...</mytaglib> </div> </body></html> 

you can use couple lines of code, called body onload slow div belongs , show it. $('#slowstuff').insertafter('#somediv') located in right place, , $('#slowstuff').show(); show.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -