0

Internet Explorer で $(window).resize が機能しないという問題があります。今のところIE 8でのみチェックしました。

基本的に、私は関数を作成しました。それをcalculation()と呼びましょう。この関数は、ウィンドウの現在の幅に基づいて一部の要素の幅/高さを変更します。したがって、その関数は、ドキュメントの準備ができているときと、ブラウザのサイズが変更されるたびに呼び出す必要があります。しかし、関数ウィンドウのサイズ変更を呼び出すと、IE では機能しません! しかし、さらに奇妙なのは、ウィンドウのサイズ変更ではなく、ドキュメントの準備ができている場合に完全に正常に機能することです。

コードは次のとおりです。

jQuery.noConflict();   
jQuery(document).ready(function($){ 
    calculations(); // works fine here, it does all what it should do

    $(window).resize(function(){
        calculations(); // works fine in all browsers except IE
    })

    function calculations() {
      //definition of function calculations here (i haven't pasted the exact function, all it does is change some widths and heights)
    }

});
4

1 に答える 1

0

多分 :

var jNoConflit = jQuery.noConflict();   
jNoConflit(document).ready(function(){ 
    calculations(); // works fine here, it does all what it should do

    jNoConflit(window).resize(function(){
        calculations(); // works fine in all browsers except IE
    });

    function calculations() {
        alert("toto");
    };

});
于 2012-05-03T10:29:55.570 に答える