【发布时间】:2012-07-27 01:22:27
【问题描述】:
正在处理的页面的核心看起来像这样http://jsfiddle.net/AUCYf/1/,当用户从搜索引擎登陆它时,应该打开“切换框”中已搜索的内容。我找到了很多关于使 AJAX 可爬网的教程,但我一直坚持实现我在标题中提到的脚本。
现在发生的事情是当我点击按钮 'LINK1' div1 打开并且 url 是:mypage.com/#link1
我需要在直接访问 mypage.com/#link1 时打开 div1。
另外,因为可以同时打开更多的 div,有没有办法做这样的事情 mypage.com/#link1&link3
【问题讨论】:
-
我对此的解决方案是检查
window.location,看看在我们的window.location中找到的hash是否与某些unique identifier populated into the container by the ajax call.相同,如果不是,那么create a conditional statement to perform the above described。 -
感谢您的回答。网上有没有例子?我在 js 中不是那么好,所以我不能直接从我的脑海中做到这一点。
标签: jquery ajax history.js pjax jquery-bbq