现在要实现这样了一个效果。在点击一个下载按钮时,遮罩整个页面。并在遮罩层上方显示一个加载图,在指定的时间10000ms后遮罩效果和加载图又自动隐藏。(本想做一个进度条与数据库读取同步的。但感觉麻烦,所以就设置了一个定值10000ms),下面是js,引用的thickbox.js,对它做了一点点修改。
疑问:我要实现的这样了一个效果。在firefox下设置断点,调试时能达到我要的要求。但断点一去。点击下载的时候。不再显示遮罩层效果。怀疑是不是setTimeout的用法不当。
var tb_pathToImage = "images/loadingAnimation.gif";
var t;// add sunqs
function tb_init(domChunk){
jQuery(domChunk).click(function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});
}
function tb_show(caption, url, imageGroup) {
try {
if (typeof document.body.style.maxHeight === "undefined") {//ie6
jQuery("body","html").css({height: "100%", width: "100%"});
jQuery("html").css("overflow","hidden");
if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
jQuery("body").append("
}
}else{//all others
if(document.getElementById("TB_overlay") === null){
jQuery("body").append("");
}
}
if(tb_detectMacXFF()){
jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
}else{
jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
}
if(caption===null){caption="";}
jQuery("body").append("");//add loader to the page
jQuery('#TB_load').show();//show loader
t=setTimeout(tb_remove(),100000);//add sunqs 10000ms auto disaplear
} catch(e) {
//nothing here
}
}
function tb_remove() {
jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').remove();});
jQuery("#TB_load").remove();
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
jQuery("body","html").css({height: "auto", width: "auto"});
jQuery("html").css("overflow","");
}
return false;
}
[b]问题补充:[/b]
浏览图显示效果