Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
481 views
in Technique[技术] by (71.8m points)

internet explorer - jQuery .load method not firing on IE9

I have 4 divs (class=mydiv), each with an image in, the load method fires on all other browsers I've tested but it does not fire on IE9.0. I don't know if it works in any other IE.

$.noConflict();

jQuery(document).ready(function(){

    jQuery('.mydiv img').load(function(){

        alert("fired");

    });

});

Tried using these jQuery versions:

1.4.2
1.5.2
1.6.2
1.5.1rc1

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem and solved using:

if ($.browser.msie && parseInt($.browser.version) < 10) {
    window.onload = new function() {
        console.log('LOADED IE');
    }
} else {
    $(window).load(function(){
        console.log('LOADED');
    })
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...