【发布时间】:2012-11-29 06:56:31
【问题描述】:
我有具有这种布局结构的 ASP.NET MVC 3 + JQuery Mobile 应用程序:
<body>
<div class="page" data-role="page" data-add-back-btn="true" id="page">
<div data-role="header" data-position="fixed"></div>
<div data-role="content" id="content">
@RenderBody()
</div>
<div id="footer" data-role="footer" data-position="fixed"></div>
</div>
</body>
问题是,绑定到窗口的事件处理程序卡住了几个页面。
例如,我有 2 个页面:"Index" 和 "About"。在"Index" 中,我绑定了一些处理程序(比如$(window).click() 事件上的console.log("index"))。但是当我转到"About" 页面时 - 这个处理程序仍然处于活动状态。
有没有办法只在适当的页面处于活动状态时才保留处理程序?
【问题讨论】:
标签: jquery asp.net asp.net-mvc-3 jquery-mobile jquery-events