将 url 重定向到#(锚点)
我有一个刚刚转换为使用锚点导航的网站。
hwww.site.com/shows 现在是 www.site.com/#shows
它将信息从 /shows 目录加载到 div 并添加哈希标签来告诉你在哪里。
问题是,如果您访问 www.site.com/shows,内容仍然存在,但没有样式。如何让它重定向而不进入重定向的无限循环?
我相信我已经解释得很清楚了,希望你们能明白。
I have a site that I just converted to use anchor navigation..
hwww.site.com/shows is now www.site.com/#shows
It loads the info from the /shows directory to a div and adds the hash tag to tell you where you are.
The problem is, if you go to www.site.com/shows, the content is still there, but unstyled. How can I get it to redirect without going into an infinite loop of redirects?
I'm sure I explained that terribly, hopefully you guys get it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
jQuery Ajaxy 通过标准的
redirect
选项包含此功能。您可以在即将推出的网站中看到这一点。没有哈希:
http://staging.balupton.com/projects/jquery-lightbox
将重定向到:
http://staging.balupton.com/#/projects/jquery-lightbox
使用它非常简单明了(特别是考虑到它允许您做什么!),而且支持非常棒。您可以在其主页上查看演示、使用示例和说明:
http://www.balupton.com/sandbox/jquery-ajaxy/demo/< /a>
jQuery Ajaxy includes this by standard with the
redirect
option. You can see this in action in a upcoming website here.Without the hash:
http://staging.balupton.com/projects/jquery-lightbox
Will redirect to:
http://staging.balupton.com/#/projects/jquery-lightbox
To use it is surprisingly simple and straightforward (especially considering what it allows you to do!), and the support is fantastic. You can check out demos and usage examples and instructions at it's home page:
http://www.balupton.com/sandbox/jquery-ajaxy/demo/
我在我的网站上所做的事情是这样的:
What I do on my site is something like: