admin管理员组文章数量:1333622
When I browse a repo in GitHub (example: ) and click a folder, it loads the folder with a cool javascript animation, moving stuff to the left, instead of reloading the whole page. However, the URL of the page is still updated on every click.
How do I achieve this? To my knowledge, you cannot update the page URL from javascript, so you need to refresh the page. My guess is that they do a partial caching of the page so that it does not seem to reload and then run the javascript animation after reload. Am I on the right track? Any pointers on how this can be achieved? My environment is jQuery and rails, but a general advice will help also.
When I browse a repo in GitHub (example: https://github./sizzlelab/kassi) and click a folder, it loads the folder with a cool javascript animation, moving stuff to the left, instead of reloading the whole page. However, the URL of the page is still updated on every click.
How do I achieve this? To my knowledge, you cannot update the page URL from javascript, so you need to refresh the page. My guess is that they do a partial caching of the page so that it does not seem to reload and then run the javascript animation after reload. Am I on the right track? Any pointers on how this can be achieved? My environment is jQuery and rails, but a general advice will help also.
Share Improve this question asked Jul 12, 2011 at 7:58 KustiKusti 1,3592 gold badges10 silver badges18 bronze badges 3- Saw this today and was also curious. But not enough to dig in :( – Jordan Commented Jul 12, 2011 at 8:02
- possible duplicate of GitHub Slider JQuery Plugin... – Merlyn Morgan-Graham Commented Jul 12, 2011 at 8:13
- Merlyn: yeah, that question is close, but I'm more interested in the method of updating url via refreshing the page than the actual slide effect they have in GitHub, and there seems to be no answers to that in the other question. But thanks for the ment! – Kusti Commented Jul 12, 2011 at 12:58
2 Answers
Reset to default 5what you want is watch this screencast: http://railscasts./episodes/246-ajax-history-state
in bination with jQuery UI effect "slide" - http://docs.jquery./UI/Effects/Slide
good luck!
You can read about this behaviour in spec — History API and on MDN in section "Adding and modifying history entries".
本文标签:
版权声明:本文标题:javascript - How do I achieve the "GitHub browse repo effect" (update URL without refreshing the page) - Stack 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742348950a2458096.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论