简体   繁体   中英

JQuery fades not working in IE9

I'm new to JQuery and can't for the life of me figure out why this isn't behaving properly. As the content in my "content" div changes, I want it to fade in and out. I created a generic "load" function to do this:

function loadPage(page, callback) {
    if(current_doc != page) {
        current_doc = page;
        $("#content").fadeOut(400, function() {
            $("#content").load(current_doc, function() {
                $("#content").hide().fadeIn(400, function() {
                    if(typeof(callback) == 'function'){ callback(); }
                });
            });
        });
    }
}

Is there some sort of glaring mistake that I'm missing?

Thanks.

PS - This code works fine in Firefox.

One thing to check in IE, in Internet Options > Advanced, under Multimedia should be a checkbox that says "play animations in webpages". Ensure that is checked.

While I'm not entirely sure why, placing the content div inside another div and fading that instead seems to have done the trick. I would think that that would have been giving me issues only if "content" itself were being deleted, but that isn't the case from my code. Oh well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM