0

ie を使用し、ブラウザ ウィンドウの幅が 1400 未満の場合にアニメーションを変更するスクリプトを実行しようとしています。ウィンドウの幅を変更するとコンソールに正しいテキストが表示されますが、コード (アニメーションの変更) が機能しません。誰でも助けることができますか?

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

$(document).ready(function() {



  function checkWindow() {


                if ( $.browser.msie ) {

                if ( $(window).width() >= 1400 ) {    

                $("#box1").everyTime(2, function(){                        
                         $("#box1").animate({top:"-20px"}, 3000).animate({top:"-10px"}, 3000);
                      });  
                $("#box2").everyTime(10, function(){                        
                         $("#box2").animate({top:"-100px"}, 2500).animate({top:"-90px"}, 2500);    
                      });        

                console.log("width over 1400");

                } else {

                $("#box1").everyTime(2, function(){                        
                         $("#box1").animate({top:"-200px"}, 3000).animate({top:"-100px"}, 3000);
                      });  
                $("#box2").everyTime(10, function(){                        
                         $("#box2").animate({top:"-200px"}, 2500).animate({top:"-900px"}, 2500);    
                      });    

                console.log("width under 1200");      

                }

                }

   }

var resizeTimer;


$(window).resize(function() {
     clearTimeout(resizeTimer);
     resizeTimer = setTimeout(checkWindow, 100);
});





});
4

1 に答える 1

0

おそらくどこかで$.stopTimeを呼び出す必要がありますか?それ以外の場合、$。everyTime呼び出しは、ウィンドウのサイズが変更された後も持続します。

于 2012-05-09T11:17:23.137 に答える