ASP.Net MVC slow JS load
I have a partial view within my application that uses a custom js control. The control effectively turns a listbox into a checked drop down list. That works perfectly. The quite lengthy code that deals with the rich interactivity for this (not the actual control creation) is in a seperate js file, referenced by the partial view.
When the partial view loads, there is a n开发者_运维问答oticable visual delay where the listbox renders into the dropdownlist. You initially see the listbox, and then the dropdownlist.
However, if I include the JS code in script tags within the view then there is no delay. When the page loads, the control is fully rendered.
The JS file does not contain the logic for creating the control, just my manipulation code.
Anybody know why there would be such a delay using the same code, but with the difference being caused whether I am referencing a JS file or embedding the code direct into the view?
Thanks.
How many items are in the dropdown?
There is a known issue in IE8 with rendering long lists, it can be seriously slow!
Is the script in the external file wrapped with $(document).ready(...) or similar which would cause it to wait for all other elements to be rendered before executing?
精彩评论