从另一个页面转到页面的特定部分 - 锚点位置和 jQuery?
我完全不知道从哪里开始,所以我对缺乏向您提供的代码表示歉意。
我的问题是 - 我有一页信息,按 ID 排序(从数据库收集)。这些 ID 是从用户单击链接的另一个页面引用的,它将它们带到包含信息的页面,但是,该页面上可能有数百个 ID - 所以我需要引用每个特定的 ID,以便当用户点击时,它会将他们带到 ID 的确切位置。
我理解它类似于 localhost:8888/index.html#id3 等。
但我很难理解如何引用 PHP 变量。
非常感谢。
I have completely no idea where to start so I apologise about the lack of code presented to you.
My problem is - I have a page of information, ordered by ID (gathered from the database). These ID's are referenced from another page to which the user clicks on a link and it takes them to the page with the information on, how ever, there could be potentially hundreds of ID's on that page - So I need to reference each specific ID so when the user clicks, it will take them to the exact position of the ID.
I understand its something like localhost:8888/index.html#id3 etc..
But i'm struggling to understand how to reference for a PHP Variable.
Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用锚点,例如,在列出信息的页面上附加一个锚点例如
#id1
,然后在链接页面上,将#id1
放在网址results.html?#id3
的末尾代码>You would use anchors, so for example, on the page where you list your information, attach an anchor to it such as
#id1
, then on your links page, you would place the#id1
at the end of the urlresults.html?#id3