Chrome 不显示和隐藏加载程序
我使用以下函数来显示和隐藏浏览器工作时包含加载图像的 div。它在 Firefox 中运行良好。但在 Chrome 中它不会这样做。即使鼠标不在其上方,屏幕仍保持静态,并且开始函数调用的按钮处于“单击”状态。如果我使用开发人员工具设置断点,那么我会看到 setVisibility() 函数被调用,并且加载器 div 被正确显示和隐藏。
该函数如下所示:
function setVisibility(id, visibility) {
if(document.getElementById(id)){
document.getElementById(id).style.display = visibility;
}
}
这是显示/隐藏调用的示例:
setVisibility("loader", "inline");
setVisibility("loader", 'none');
有什么想法吗?
I'm using the following function to show and hide divs that contain loading images when the browser is working. It works fine in Firefox. In Chrome though it doesn't do this. The screen remains static with the button that begins the function calls in the "clicked" state, even though the mouse is not over it. If I use the developer tools to set breakpoints then I see the setVisibility() function get called and the loader divs get shown and hidden properly.
The function looks like this:
function setVisibility(id, visibility) {
if(document.getElementById(id)){
document.getElementById(id).style.display = visibility;
}
}
And here is an example of a show/hide call:
setVisibility("loader", "inline");
setVisibility("loader", 'none');
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定您是否对 jquery 了解很多,但我会包含最新的 jquery 并使用 .show() 和 .hide() 方法...
http://docs.jquery.com/Show
n/m 这个花絮,你用的是display,可见性函数名通过我关了。
I'm not sure if you know much about jquery but I would include the latest jquery and use the .show() and .hide() methods...
http://docs.jquery.com/Show
n/m this tidbit, you're using display, the visibility function name through me off.
我希望这有帮助
用此代码替换您的函数
i hope this helps
RELACE YOUR FUNCTION WITH THIS CODE