我正在尝试做一些我认为很简单的事情,但实际上我没有运气.我想要做的就是在文档加载完毕后经过X秒后淡出div.
在我的Site.Master文件中,我有以下内容:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<!-- various other links, etc commented for brevity -->
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.2.6.js")%>"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#notify-container").fadeOut(2000);
}
</script>
</head>
<body class="page">
<%
if (Html.ViewContext.TempData.ContainsKey("StatusMessage")) {
%>
<div id="notify-container"><%=Html.ViewContext.TempData["StatusMessage"]%></div>
<%
}
%>
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
问题是没有任何事情会消退.我忽略了什么?
我想你错过了一些代码
$(document).ready(function() {
$("#notify-container").fadeOut(2000);
}
Run Code Online (Sandbox Code Playgroud)
应该...
$(document).ready(function() {
$("#notify-container").fadeOut(2000);
}); // <---
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1419 次 |
| 最近记录: |