DIV更改样式属性时未在Chrome中显示

时间:2015-06-23 19:41:14

标签: javascript jquery css

好的,所以,我使用JQuery来显示/隐藏“处理”'我页面上的div元素。以下是基本代码:

function ShowLoading(){
    $(divLoadingPanel).show();
}

function HideLoading(){
    $(divLoadingPanel).hide();
}   

在我的各种Javascript函数中,我根据需要调用ShowLoading()和HideLoading()。在FireFox中查看页面时,一切正常。在Chrome中查看时,从未看到加载面板。但是,如果我在面板之后调试并在线上断开 显示,它在那里。手动遍历代码时它会显示正常,但如果我不使用断点和调试器则不会。这令我感到困惑。这是div本身的代码:

<div id="divLoadingPanel" class="Loading_Panel" style="display: none">
    <br>
    <img src="./images/8.gif">
    <br><br>
    <font class="Loading_Text">Processing...</font>
</div>

最后,这里是小组的课程信息:

.Loading_Panel {
    position:fixed;
    top: 50%;
    left: 50%;
    width:300px;
    height:150px;
    margin-top: -75px;
    margin-left: -150px;
    background: #E9F2FA;
    border-radius: 10px;
    border: 1px solid #1C4E7C;
}

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

将您的代码更改为:

 function ShowLoading(){
     $("#divLoadingPanel").show();
 }

 function HideLoading(){
     $("#divLoadingPanel").hide();
 }