jquery dialog takes a while to open
Currently we have a jquery dialog which contains 4 tables. Each hasa number of checkboxes in it:
- First box has about 开发者_开发技巧10 checkboxes
- Second about 300 (one per country)
- Third and forth have about 100 each
When I click on the button to open the dialog it can take a while IE7 = 10seconds IE6 = 15+ seconds
Even chrome takes 2 seconds to simply open a dialog (a noticeable delay).
Is jquery just not able to process the dialog open quickly when its has a dialog with alot of DOM objects?
P.S. The dialog has already been initialized on page load, so I would assume the dialog open would be near instant.
Firstly try to open the dialog box and then append the content. sometimes this considerably improves the performance.
$('#dialog ').dialog('open');
$('#dialog ').html(yourContent);
Also try familiarising yourself with jQuery performance rules as there is such thing as writing bad slow jQuery:
http://www.artzstudio.com/2009/04/jquery-performance-rules/
And finally sometimes when the content of the modal box are heavy setting the draggable to false also can improve the performance of the box. so if you don't need the draggable try:
draggable: false
精彩评论