Ajax Loader IE 7-未显示

问题描述

我正在使用ajax加载程序。在IE7中没有显示加载时出现的图像,但在IE 8和FF中可以正常工作。 我已经使用以下jQuery的加载器:-
initLoader(); 

function initLoader() 
{
    //Get the A tag
    var id = $(\'#dialogLoader\');

    //Get the screen height and width
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();

    //Set height and width to mask to fill up the whole screen
    $(\'#mask\').css({ \'width\': maskWidth,\'height\': maskHeight });

    //Get the window height and width
    var winH = $(window).height();
    var winW = $(window).width();

    //Set the popup window to center
    $(id).css(\'top\',winH / 2 - $(id).height() / 2);
    $(id).css(\'left\',winW / 2 - $(id).width() / 2); 
}

function showLoader() 
{
    //transition effect     
    $(\'#mask\').show();
    $(\'#dialogLoader\').show(); 
}

function hideLoader() {
    $(\'#mask\').hide();
    $(\'#dialogLoader\').hide();
    $(\'.window\').hide(); 
}

//To Start and hide loader 
$(\"#mask\").bind(\"ajaxStart\",function () {
  //alert(\'start\');
  showLoader();
}).bind(\"ajaxStop\",function () {
    //alert(\'end\');
    hideLoader();
});
这是CSS:-
/* Loader CSS start */
#mask
{
    position: absolute;
    left: 0;
    top: 0;
    z-index: 9000;
    opacity: 0.4;
    -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)\"; /* first!*/
    filter: alpha(opacity=40); /* second!*/
    background-color: gray;
    display: none;
}

#Boxes .window
{
    position: absolute;
    left: 0;
    top: 0;
    width: 440px;
    height: 200px;
    display: none;
    z-index: 9999;
    padding: 20px;
}

#Boxes #dialogLoader
{
    width: 70px;
    height: 60px;
    padding: 20px;
    text-align: center;
    background-color: #ffffff;
    border-radius: 20px;
    -moz-border-radius: 20px;
    font-size: 0.9em;
    font-family: Arial;
}
/* Loader CSS End */
正在显示遮罩,窗口变灰,但未显示加载图像,请让我知道这对于IE 7是如何工作的。 谢谢!!!     

解决方法

        我编辑了您发布的代码。 由于您的代码最初发布于此行:
//To Start and hide loader $(\"#mask\").bind(\"ajaxStart\",function () {
如我上面所示。 这是无法编译的代码,因为它注释掉了该语句的开头。 当您将其复制到此处时,这只是一个错字吗?还是这个问题?
<CR>
<LF>
可能有问题。 我会确保它们是正确的,然后尝试。     ,        我的猜测:它不喜欢您有一个类名
.window
,在这里引用:
$(\'.window\').hide(); 
或者,而且很可能是因为变量名为
id
,IE讨厌这样做,因为它引用了其他内容...我正试图找到更多有关此的信息,但不久前它给我带来了类似的麻烦。 编辑:我的上述评论可能使我完全偏离了轨道,只是因为调试IE是唯一一个不能很好地使用它的浏览器,所以花了两天时间调试了AJAX请求之后,当它使IE崩溃时,我变得有些偏执。 关于您刚刚发布的CSS,我强烈建议您使用jQuery设置不透明度,它大部分是跨浏览器兼容的,而CSS则不是。