如何当用户点击从阿贾克斯填充的无限滚动搜索结果中的链接修复后退按钮? [英] How to fix the back button when user clicks a link from ajax-populated infinite scroll search results?

查看:104
本文介绍了如何当用户点击从阿贾克斯填充的无限滚动搜索结果中的链接修复后退按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ajax在搜索结果页面上的无限滚动分页。

I have infinite-scrolling pagination on a search result page using ajax.

我怎样才能让这个当用户点击一个异地并通过后退按钮返回链接,结果被滚动到页面,他们离开?

How can I make it so that when a user clicks a link off-site and returns via the back button, the results are scrolled into the ajax-loaded portion of the page where they left?

推荐答案

谷歌的jQuery AJAX历史插件。有很多。

Google for jQuery ajax history plugins. There are many.

也仰望的jQuery插件haschange: http://benalman.com/projects/jquery- hashchange-插件/

also look up jQuery haschange plugin: http://benalman.com/projects/jquery-hashchange-plugin/

基本上你添加/更新(可能增加)一个'#结果集= 1'到页面的URL。然后,使用haschange插件,例如。你可以触发你自己的code,后退或前进多少的结果通过分页等进行了图示当用户单击后退按钮,回来到您的网页,上载发射haschange应该,如果你的工作在网址已经连接好您的分页的工作#...

basically you append / update (possibly increment) a '#result-set=1' to the page's URL. Then using the haschange plugin for eg. you can trigger your own code, move back or forward to how much of the results were shown by pagination etc. When a user clicks the back button and comes back to your page, the on load firing of haschange should work if you've wired up your pagination to work of the '#...' in the URL

这篇关于如何当用户点击从阿贾克斯填充的无限滚动搜索结果中的链接修复后退按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆