Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Anchor tag not working correctly

Featured Replies

Hello all. I am having a problem with my anchor tags on a site I am working on.

 

They work fine when you load the page up first time and link to the relevant sections correctly. The problem happens once you click on the Blog link.

 

Once you click on the Blog link in the header and click on a post, the sticky nav is not working correctly.

 

If you then click on another link in the header to take you back to that section, it does not jump to the top of the section like it does when first load the page. The page jumps to a point which is below the top of the section.

 

You can view the site here.

 

I'm not sure why the anchor tag is behaving like this because once you click on another link it works fine. It only does not work when you are trying to link back from a blog post.

 

Can anyone help with this problem?

Hi , it's because all links are navigating you on the main page without reloading the site just scrolling on the index (index.php) to clicked categories. But once you click on a blog post it will open a new page (I'm not sure but I think it's post.php) on your site . After clicking back on other link pointing to index.php#something the browser is trying to find #something-point on your site but it's not fully loaded so #something is not found , that's why it keeps you on top of the page.

 

However I'm using chrome33 and after couple of seconds (until site loads) it will scroll to clicked section. I think it's not working in all browsers like it is in chrome.

 

I hope u can understand me and it helped

  • Author

Thanks for your reply.

 

Do you know of a way I can get it to jump to the correct section? I have tried to create a div above the section with an anchor link, but this does not work either.

 

I'm not sure how I can get it to work like on the homepage.

 

Can anyone help?

To make anchors that jump you need to use the following.

<a href="#name">Jump to Name</a>

And then you can use this.

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

Good luck!

  • Author

Thanks for your reply. That is what I have tried, but it did not work.

 

In my header.php file I have the following:

 

<a href=" <?php echo get_site_url(); ?>#abouthome" title="" style="background:#585fad;"> About </a>

Then in the backend of Wordpress at the top of the About page I have the following:

 

<a name="abouthome"> </a>

This does not seem to work as the link jumps to the section, but not at the correct point. It jumps below the anchor so that the section header is not shown.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.