Why anchors do not work in Ruby on Rails?

So, I have links that have a href value for ajax loading and an onclick value for a link to the top of the page. When I click the links, the ajax content is loaded, and the URL shows the link to the anchor, but the page does not move to the anchor.

I tried both in show.html.erband in bindings index.html.erb, which visually show where they should be for testing, when I scroll up, but the page does not move to this place. Any ideas what could be causing this?

show.html.erb and index.html.erb

<a name="#posts_top">love and kittens</a>

When you click on the screen, the browser URL is visually displayed:

http://localhost:3000 => http://localhost:3000/#posts_top

However, the content loads and the page only slightly skips to accommodate the new content, but does not move the anchor.

Any thoughts would be greatly appreciated!

thank

0
1

href ( name, id.

:

<h3><a name="menu">Menu</a></h3>
<ul>
<li><a href="#a001">Jump to a001</a></li>
<li><a href="#a002">Jump to a002</a></li>
<li><a href="#a003">Jump to a003</a></li>
</ul>

<h3><a name="a001">a001</a></h3>
<p>paragraph text ...</p>

<h3><a name="a002">a002</a></h3>
<p>paragraph text ...</p>

<h3><a name="a003">a003</a></h3>
<p>paragraph text ...</p>

<hr>

<p><a href="#menu">Jump to Menu</a></p>

, id name ...

<a href="#a001">Jump to a001</a>

...

<h3 id="a001">a001</h3>

+1

All Articles