The link goes to the top of the page instead of the section.
Can anyone tell me what I’m doing wrong? Please?
The link I used
https://focus-merch.webflow.io/#focus-brand-merch
The section ID
focus-brand-merch
The link goes to the top of the page instead of the section.
Can anyone tell me what I’m doing wrong? Please?
The link I used
https://focus-merch.webflow.io/#focus-brand-merch
The section ID
focus-brand-merch
Can you please post your read-only link so we can investigate this issue further?
Here’s a read only link. I noticed the same thing happened to the section links on the home page if I add the url. I really need it to link back from the shopping page Very frustrating. Thanks so much!
Thanks again for taking interest. I really appreciate it!
I seemed to have solved the problem. I’m not quite sure how so I won’t share the messy details.
Hey Catherine and @PixelGeek , one thing I’ve noticed with Chrome in particular is that if an element is hidden ( display: none
), then Chrome thinks it’s positioned at 0,0. Thus if you try to use a #fragment
to scroll to it while it’s hidden, you’ll generally get scrolled to the top of the page.
I haven’t tested this theory, but it seems likely that if you have an interaction in which the element starts as display: none
, then when you first load the page, it will be impossible to #navigate
to its normal location.
The way around it might be to have an empty DIV element just before your section in the layout, which gets your id = whatever
. Since it will never be hidden, even with interactions, it should always work, and it shouldn’t affect your layout at all.
Pro tip, when you use #fragment
navigation, Chrome also seems to try to scroll that element to the very top of the browser window. In most cases that doesn’t look ideal. If you want a bit of page above it, you can use my empty DIV technique above, and then position it relative
with a top
of say -200px
. Chrome will consider that anchor to be 200 px higher than it actually is, and your scroll-to point well be more eye-level.
Thanks!
I haven’t noticed a problem with Chrome since I solved the initial problem. I will definitely try this if the problem occurs!