将 jQuery 库升级到版本 1.10 后,代码停止工作



当用户单击页面上的链接/按钮时.gif我正在使用以下jquery代码来显示加载。

<div class="progress-indicator">
  <img src="/myapplication/images/loading.gif" alt=""  />
</div>

<script>
  $j(window).bind(
           $j.browser.opera ? 'unload' : 'beforeunload',
           function(){
              //display image container
              $j('.progress-indicator').css( 'display', 'block' );
              //set a little timeout and force re-displaying of the image
              //this can work around IE behavior, that 'freezes'
              //animations during a submit
              setTimeout( function() {
                  $j('.progress-indicator > img').attr( 'src',
                  $j('.progress-indicator > img').attr('src')+'?reload' );
              }, 50 );
            } );
</script>

它在"jquery 版本 1.5.1"中运行良好,直到我将 jquery 升级到版本 1.10.0。代码不再有效。

谁能帮我?非常感谢您的帮助和建议。

.browser()

jQuery 1.9 中删除

http://api.jquery.com/jQuery.browser/

升级时,您应该使用 jQuery Migrate 插件来检查您的脚本。

http://jquery.com/upgrade-guide/1.9/#jquery-migrate-plugin

这是一个升级指南

1:http://jquery.com/upgrade-guide/1.9/和迁移插件

尝试查找问题

最新更新