Anchor problems

hello,

when i jump to an anchor (from a front page menu item) everything looks fine, but when i do the same from another page menu item, the section referred by the anchor displays one or two lines less at the top, and that prevents me to use sticky menus (the headline of the section goes under the sticky menu). is it fixable?

thanks,
sega

Ah now I get it.

Ok first of all, you should not use anchors with name attribute. name atttribute is no longer supported in html5.
Instead use id.

Next thing is, that the html element that contains for example the <a name="calendar"></a> is causing the browser to pull the containing element to the very top of screen when accessing the yourdomain.com/#calendar from a sub site.

To get it right, modify your anchors like so:

<a id="calendar" class="anchorhome"></a>

Exchange calendar with whatever the name was before.
Then add this to your custom CSS:

a.anchorhome {
    position: absolute;
    visibility: hidden;
    left: 0;
    top: 0;
    z-index: 15;
}

This should make your menu links scroll to the right position when clicked on a sub page.

However when you click on a menu link now on the front page, the scrolling destination will be a bit above the top border of the containing element.
To solve it perfectly you would have to write some custom jquery for example. The front page behaves like this because there seems to already be some sort of jquery/JavaScript in place to handle the scrolling event in a way. That javascript caused some unwanted behaviours on my site as well. I deactivated some functions. Maybe the theme developer should look into those scripts…

Anyaways, hope I could help :slight_smile:

dear saskia,

everything is now in place, thanks to your golden code hints!

i can live with the front page glitch, as my jquery skills are inexistent :slight_smile:

thanks a lot for your time and patience to look into this,
sega

Saskia,

I am having similar issue as above. This is the first time I am using anchor links inside a theme, and while I think I have it nailed. However there is still a piece that is puzzling me. normally I would pad/offset the anchor in order for the section to at least center on the page. I can not figure out how to do this inside the front page for the Moesia Theme. My website is http://wrightaerial.com.

Having same problem in the menu I placed the url/#name and in the page I placed shortcode for the anchor. But it doesnt scroll to the right section from other pages also in the same page its not displaying 100% correct. www.redchairtattoo.com the link I am refering to is Prices in the top menu

Alex

Hi Sega,

Great! I’m glad it’s resolved for you.

@Christopher Moore - Please post this to Moesia Theme Forum, so we can help you there.

@alexrams - The Prices link on top leads to a new page called Prices, if you want to link it to the section with Prices / Deposit ( on your HomePage ), please add this: url/#pg-219-2 as Custom Link in your menu, so it will scroll down to that section.

Best Regards,
Csaba

Hi csaba

I have a problem like this, I have a custom link in menu for “About Us” with http://www.khorshidnoor.com/#pg-8-9 url. This menu item great work when click it in Front Page, but when click it in another pages like my Blog page or from another site by link, another section of Front Page is shown! What can I do?!

I tested everything and found something. When “Page Builder by SiteOrigin” plugin is activated, custom link from other pages has problem. But when I deactivate that plugin, custom link work from anywhere but other things have problems! What can I do now?!

Thanks
Best Regards
Kaveh

Hi @k.kavandi,

Please open a new topic, so we can help you there.

Kind Regards,
Csaba