使用 href 链接转到网站内的特定部分

发布于 2024-08-21 12:18:44 字数 1113 浏览 5 评论 0原文

我正在尝试将一些带有 href 标签的文本链接到我的网站中的特定部分。

在主页上我有一句话,然后是说这句话的人的名字。我想将他的名字链接到“关于”部分的“即将举行的活动”选项卡。

该网站是http://www.verticalministries.net。 “Aaron Ivey”这个名字需要链接到“关于”部分下的“即将举行的活动”选项卡。该网站是一个使用 JavaScript 滚动的单页组合。

我尝试过使用 name 属性,但这不起作用,因为 href 标签看起来像

<div class="fifth_page" style="display:none"> 
            <h1>Upcoming Events</h1>
                <h4>Feb. 15 &#45; Aaron Ivey Band</h4> 
                <a name="#ivey"></a>
                <img src="images/iveypromo.jpg" alt="Aaron Mug Shot" class="floatRight img_left_space" />
               <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深府石板幽径 2024-08-28 12:18:44

不要使用已弃用的属性 name,而是使用 id

示例代码,如何使用 anchor 跳转到 div 具有指定的 id:

<a href="#your-page-element">Jump to ID</a>

<div id="your-page-element">
    will jump here
</div>

同样对于使用 jQuery 滚动动画,请查看 如何使用 jquery 滚动到页面上的特定位置?

don't use attribute name it's deprecated, rather use id

example code, how to jump with an anchor to a div with specified id:

<a href="#your-page-element">Jump to ID</a>

<div id="your-page-element">
    will jump here
</div>

Also for scrolling animations with jQuery look at How can I scroll to a specific location on the page using jquery?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文