问题
I'm using the following code to call in some html, and display it. Most browsers seem to handle it fine, but IE6 and 7 freeze up. Unfortunately, the request can sometimes take more than a few seconds, so the delay is noticeable.
I'm also calling Fancybox on success, so that the returned html can have a link that launches a modal window.
Code:
$.ajax({ url: 'url', success: function(data) { $('#videolink').hide(); $('#videolink').html(data).slideDown(); $("a#video").fancybox({ 'hideOnContentClick': false, 'transitionIn' : 'elastic', 'transitionOut' : 'fade', 'titleShow' : false, 'scrolling' : 'no', 'onStart': function() { _gaq.push(['_trackEvent', 'Event Title', 'Value']); }, 'callbackOnClose': function() { $("#fancy_content").empty();} }); } });
Is this the best way to handle the request?
回答1:
Is your iexplore process using 100% CPU? If yes, then the problem is with slow DOM manipulation by IE. Try commenting out lines in success callback to check if you can find the offending one...
来源:https://stackoverflow.com/questions/3757153/ie6-7-freezing-during-jquery-ajax-request