我正在使用ajax loader。加载时出现的图像没有在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是如何工作的。 感谢!!!
答案 0 :(得分:0)
我编辑了您发布的代码。
由于您的代码最初发布在此行:
//To Start and hide loader $("#mask").bind("ajaxStart", function () {
正如我在上面所示。
这是无法编译的代码,因为它注释掉了这个语句的开头。
当你在这里复制它时,这只是一个错字吗?或者这是问题。
<CR>
和<LF>
可能存在问题。
我会确保它们是正确的并尝试。
答案 1 :(得分:0)
我的猜测:你不喜欢你有一个类名.window
,在这里引用:
$('.window').hide();
或者,很可能,因为名为id
的变量,IE 讨厌,因为它引用了其他内容...我试图找到更多关于此的信息但是它一段时间给我类似的麻烦。
编辑:我可能完全偏离了我的上述评论,只是在花了两天调试一个AJAX请求之后,因为IE是唯一一个不能很好用的浏览器,我当它惹恼IE时会变得有点偏执。
关于你刚刚发布的css,我强烈建议使用jQuery设置不透明度,它主要是跨浏览器兼容,CSS不是。