Search code examples
ruby-on-railsanchorsingle-page-applicationlink-to

New to rails... How do I set and call specific anchor points for a single page


So I want to create a single page portfolio, and I want to set anchor points so users can click on the nav bar and it jumps to the specific section of the page. So far I have this to set my anchor point:

<%= link_to "Code Snippets", anchor: "code_snippets" %>
<%= link_to "See My Web Apps", anchor: "web_apps" %>
<%= link_to "Contact Me", anchor: "contact" %>
<%= link_to "Resume", anchor: "Resume" %>

I dont know if this is the right syntax, but this is what I have found online so far...

Now, how do I call these anchor points, so my page jumps to the relevant information when the user clicks the link? Thanks in advance!


Solution

  • Just need to add the html below to jump to the anchor point when you click.

    <a name="Results"></a>
    

    or

    <div id="Results"></div>