使用哈希标签进行页面导航和锚点导航的最佳方式是什么?
我正在制作一个使用哈希标签进行页面导航的网络应用程序,就像这样
http://foo.bar.com/#pages/home
我刚刚意识到我的一个页面将会巨大,包含它自己的树形结构菜单,其中的链接应该将页面滚动到页面中的不同锚标记。显然我现在不能使用实际的哈希标签,因为它们很忙。我将不得不使用一种带有这样的 URL 的编程解决方案
http://foo.bar.com/#pages/home/section
或者是否可以使用多个哈希符号,也许将其更改为这样?
http://foo.bar.com/#!/pages/home#section
但无论如何,这怎么能以编程方式完成呢?
I'm making a web application that uses hash tags for page navigation like this
http://foo.bar.com/#pages/home
I just realized that one of my pages is going to be kind of huge, containing it's own tree-structured menu with links that should scroll the page to different anchor tags in the page. Obviously I can't use actual hash tags for that now, since they are busy. I'm going to have to use a programmatic solution with an URL like this
http://foo.bar.com/#pages/home/section
Or would it be possible to use more than one hash symbol, perhaps changing it to this?
http://foo.bar.com/#!/pages/home#section
But how can this be done programmatically anyway?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会放弃hashbangs 的错误使用,改用history API 相反,并认真考虑“如果那个”的问题强>内容多正在被替换,通过 Ajax 加载它真的有好处吗?”
I'd scrap the broken use of hashbangs, switch to using the history API instead and give serious consideration to the question of "If that much content is being replaced, is loading it via Ajax really providing a benefit?"
您的问题对我来说似乎不太清楚,
如果您的页面太大,您可以使用 AJAX 和 PHP 进行分页,以获取更多信息
http://www.codediesel.com/php/simple-pagination-in- php/
或 http://www.99points.info/2011/01/ajax-pagination-using-jquery-and-php-with-animation/
否则,如果你仍然希望事情是这样在 URL #tags 中,然后您就可以使用它。
我怀疑你可以给出这样的东西“
http://foo.bar.com/#pages/home/
”你也可以尝试URL重写http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Your Question does not seem clear to me,
If your page is too large, you could go for pagination using AJAX and PHP, for more
http://www.codediesel.com/php/simple-pagination-in-php/
or http://www.99points.info/2011/01/ajax-pagination-using-jquery-and-php-with-animation/
Other wise, if you still want things to be in URL #tags, then you can go with it.
I doubt you could give something like this "
http://foo.bar.com/#pages/home/
"You could also try URL rewriting http://httpd.apache.org/docs/2.0/misc/rewriteguide.html