Clicking on a link will not scroll, even in the middle of the page Fly to the specified location.
ruby 2.5.7 Rails 5.2.4.3 OS: macOS Catalina
Specify the id class where you want to skip.
erb:app/views/homes/about.html.erb
<div id="map"></div>
python
<%= link_to "Link name",Linked path(anchor: "Specified id name") %>
The actual description is as follows.
python
<%= link_to about_path(anchor: "map") do %>
ACCSESS
<% end %>
Or
python
<%= link_to "ACCSESS", about_path(anchor: "map") %>
The URL looks like this.
http://localhost:3000/about#map
Specify the location (position) of the destination page using Rails anchor link
Recommended Posts