【发布时间】:2012-03-07 10:12:57
【问题描述】:
我有一些需要开始工作的样式页面。加载栏是页面的一部分。当页面被导航离开时,加载栏将出现(因为后端可能需要一些时间来响应)。出现加载栏后,需要在访问者等待下一页时“加载”。
代码在 IE 中运行良好,但在 Chrome 和 Safari 中有一个奇怪的错误。加载栏“出现”后,在 Chrome 的开发者工具中选择元素时加载失败 except
在下面找到 HTML CSS 和 JS。提前感谢您提供的任何帮助。
<span id="loading-footer">
<p class="loading-bar-text">Loading:</p>
<div id="loading-bar"><div id="coloured-bar" style=""></div></div>
</span>
/*loading bar*/
#loading-footer { background-color: #444; height: 93px; margin-top: 27px; position: absolute; width: 411px; display: none; border-radius: 4px; -moz-border-radius:4px; -webkit-border-radius:4px; }
#loading-footer .loading-bar-text { color: #CCCCCC; font-family: helvetica; font-weight: bold; margin: 10% 0 0 16%; width: 0; display: inline-block; }
#loading-footer #loading-bar { background-color: #151515; display: inline-block; height: 10px; margin: 0 0 -2px 75px; width: 201px; border:2px solid #394040; border-radius: 7px; -moz-border-radius:7px; -webkit-border-radius:7px; overflow: hidden; }
#coloured-bar { background: url('../images/loadingcolor.gif') left top; overflow: hidden; width: 1px; height: 10px; margin: 0 0 0 -5px; z-index: 200;}
window.onbeforeunload = function() {
$("#loading-footer").stop().show('fast', function() {
$("#coloured-bar").stop().animate({
width: "250",
},{queue:false,duration:5000});
});
}
【问题讨论】:
-
您是否尝试将 window.onbeforeunload = function() { 替换为 $(function(){ ?
标签: javascript jquery css google-chrome webkit