开发者

Is it my jQuery code or Internet Explorer that is wrong?

开发者 https://www.devze.com 2023-02-17 12:28 出处:网络
I have the following code to load an external page into a \"holder\" div on my main site. It works fine in Firefox but when a user views it in Internet Explorer 7 it seems to hang for a minute or two

I have the following code to load an external page into a "holder" div on my main site. It works fine in Firefox but when a user views it in Internet Explorer 7 it seems to hang for a minute or two and then starts to work normally. Also when someone resizes the browser window the site seems to hang again. Is there something wrong with the code below or is it just the limitations of jquery/javascript in Internet Explorer? The basket.cfm loads content from a database and the loadMyBasket function is called when a user clicks a link on a di开发者_开发百科fferent part of the site.

$.loadMyBasket = function () {
    $('.menuHolder').fadeOut('fast', function () {
        $('.menuHolder').load('http://www.mysite.com/includes/basket.cfm?selectedDay=6-Mar-11', function () {
            $('.menuHolder').fadeIn('fast')
        })
    });
};

The code above gets loaded automatically when the site first loads and also gets called when the user clicks a link to update the basket.


I see nothing wrong with your code, this may be just an IE issue. Make sure you update your version of jQuery to the most recent. Also, I would experiment with fadeOut speeds.


Well, technically Internet Explorer is always wrong, so it could be both. You are missing a ; as well.

Lots of problems reported in IE6/7 with jQuery if you Google it.


It may be that the HTML from the external page is having issues with IE7 and is causing it to hang.

It would be worthwhile checking with another static page with controlled HTML elements to make sure it is the jQuery code that is causing IE7 to hang.

0

精彩评论

暂无评论...
验证码 换一张
取 消