Ajax # 和滚动到 #
是否可以同时拥有“AJAX”哈希标记 #
以及向下滚动到一个的标记?
谢谢。
Is it possible to have both an "AJAX" hash mark #
as well as a scroll down to one?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不。
Facebook 和新 Twitter 网址中的 shebang/hashbang (#!) 有何用途? - 它是仅适用于 Googlebot。
是的。
如果你真的想两者兼得,滚动到位可以通过 JavaScript 捏造宽度。这不会很漂亮。
No.
What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for? - it's only for Googlebot.
Yes.
If you really want to have both, the scroll-to bit can be fudged width JavaScript. It wouldn't be pretty.
据我所知,片段标识符中不允许使用#。您可以将其编码为 %23 并用它做一些事情。
如果您正在执行希望能够滚动到的页面内容,则可以通过向链接添加特定类或其他内容来劫持链接。
另外,请考虑阅读history.pushState等:
https://developer.mozilla.org/ en/DOM/Manipulate_the_browser_history
As far as I know, # is not allowed in a fragment identifier. You could encode it as %23 and do something with that maybe.
If you're doing on-page stuff that you would like to be able to scroll to, you could just hijack links by adding a certain class to them or something.
Also, consider reading up on history.pushState and such on:
https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history