jquery 循环 - 无法使用 AJAX 暂停或停止
我正在起诉 jQuery 循环插件,它非常棒。然而,有一个问题我似乎无法解决。
我的页面是通过 Ajax 加载的,但是如果我直接通过浏览器刷新页面,就好像超时仍然基于之前的页面浏览量。
幻灯片本身工作正常,但寻呼机上的活动幻灯片突出显示了错误的部分。知道如何重置超时或如何在新加载时重置周期 - $('#divid').cycle('pause')
和 $('#divid')。 Cycle('stop')
似乎没有达到目的。
感谢您的任何见解。
I'm suing the jQuery cycle plug-in and it's awesome. However, there's one issue that I can't seem to get around.
My pages are loading via Ajax, but if I refresh a page directly through the browser, it's as if the timeout is still based on the previous pageview.
The slides themselves work properly, but the active slide on the pager is highlighting the wrong piece. Any idea how to reset the timeout or how to reset cycle on a fresh load - $('#divid').cycle('pause')
and $('#divid').cycle('stop')
don't seem to to the trick.
Thanks for any insight.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这会主要发生在 Firefox 中吗?我特别注意到 FF 的这种行为,它似乎在页面刷新时保持 JavaScript 状态。如果不是整个州,那就是它的一部分。您可以尝试以下操作:
不要单击刷新按钮或按 F5,而是将光标放在地址栏中并按 Enter 键。根据我的观察,这似乎会再次获取页面,并重新渲染它,清除它可能持有的任何先前的 javascript 状态。
如果在执行地址栏输入技巧后问题仍然出现,那么您就知道是代码造成的,而不是浏览器。
Would that happen to be primarily in Firefox? I've noticed this behavior with FF in particular, it seems to hold the javascript state on page refresh. If not the whole state, then part of it. Here's something you can try:
Instead of clicking the refresh button or hitting F5, put your cursor in the address bar and hit enter. From my observation, this seems to fetch the page again, and re-render it, clearing any previous javascript state that it may be holding.
If your problem still happens after doing the enter-on-address bar trick, then you know it's the code that's causing it, not the browser.