代码之家  ›  专栏  ›  技术社区  ›  gfrizzle

已设置动画的gif在提交时未设置动画

  •  10
  • gfrizzle  · 技术社区  · 16 年前

    <script type="text/javascript">
    
        $(function() {
            $("#submit").click(function() {
                $("#wait").show();
                return true;
            });
        });
    
    </script>
    
    <% Using Html.BeginForm%>
    <%-- Various input fields here --%>
    <input id="submit" type="submit" value="Submit" />
    <img id="wait" src="../../Content/images/ajax-loader.gif" alt="" style="display: none" />
    <% End Using%>
    
    3 回复  |  直到 16 年前
        1
  •  15
  •   Josh Stodola    16 年前

    这个问题只发生在IE中,对吗?Rick Strahl不久前在他的博客上讨论了这一点。请务必阅读评论。

    Animated GIF images in hidden page elements

        2
  •  5
  •   Tom Sgro    16 年前

    根据Josh的链接,我可以通过以下方式使其工作:

    setTimeout('document.images["loadimage"].src = "../Images/loading_bar.gif"', 200);
    
        3
  •  0
  •   DylanB    8 年前

    如果任何人在IE(和Edge now)中仍然存在此问题,我通过执行以下操作解决了此问题

    <div id="loader" style="display:none;">
       <img src="/loading-spinner.gif" alt="Loading">
    </div>
    

    以及以下Jquery:

     function ShowLoadingScreen {
            $("#loading-screen").show();
        }
    

    $("#loader").html($("#loader").html());
    

    所以你只剩下

    function ShowLoadingScreen {
                $("#loader").html($("#loader").html());
                $("#loading-screen").show();   
            }