使用 href 链接转到网站内的特定部分
我正在尝试将一些带有 href 标签的文本链接到我的网站中的特定部分。
在主页上我有一句话,然后是说这句话的人的名字。我想将他的名字链接到“关于”部分的“即将举行的活动”选项卡。
该网站是http://www.verticalministries.net。 “Aaron Ivey”这个名字需要链接到“关于”部分下的“即将举行的活动”选项卡。该网站是一个使用 JavaScript 滚动的单页组合。
我尝试过使用 name 属性,但这不起作用,因为 href 标签看起来像
<div class="fifth_page" style="display:none">
<h1>Upcoming Events</h1>
<h4>Feb. 15 - Aaron Ivey Band</h4>
<a name="#ivey"></a>
<img src="images/iveypromo.jpg" alt="Aaron Mug Shot" class="floatRight img_left_space" />
<p> “Aaron Ivey believes that all worship is a response to a creative and compelling God. Serving as one of the worship pastors at <a href="http://www.austinstone.org" target="_blank">The Austin Stone</a>...</p>
</div>
如果
您有任何其他问题,请告诉我,
谢谢 。
。此致,
DHJolesch
I am trying to link some text with the href tag to a specific section in my website.
On the homepage I have a quote and then the person's name of who said it. I want to link his name to the "Upcoming Events" tab on my "About" section.
The website is http://www.verticalministries.net. The name "Aaron Ivey" needs to be linked to the "Upcoming Events" tab under the "About" section. The website is a one-page portfolio that scrolls using JavaScript.
I have tried using the name attribute, but that wasn't working because the href tag would look like<a href="#about#ivey>Aaron Ivey</a>
and that just isn't valid code, because I have the page scrolling via classes. I did check the name attribute and I did give it #ivey.
<div class="fifth_page" style="display:none">
<h1>Upcoming Events</h1>
<h4>Feb. 15 - Aaron Ivey Band</h4>
<a name="#ivey"></a>
<img src="images/iveypromo.jpg" alt="Aaron Mug Shot" class="floatRight img_left_space" />
<p> “Aaron Ivey believes that all worship is a response to a creative and compelling God. Serving as one of the worship pastors at <a href="http://www.austinstone.org" target="_blank">The Austin Stone</a>...</p>
</div>
Any help would be greatly appreciated.
If you have any further questions, please let me know.
Thank you.
Sincerely,
DHJolesch
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用已弃用的属性
name
,而是使用id
示例代码,如何使用
anchor
跳转到div 具有指定的 id:
同样对于使用 jQuery 滚动动画,请查看 如何使用 jquery 滚动到页面上的特定位置?
don't use attribute
name
it's deprecated, rather useid
example code, how to jump with an
anchor
to adiv
with specified id:Also for scrolling animations with jQuery look at How can I scroll to a specific location on the page using jquery?