LeauxFi Posted November 26, 2022 Share Posted November 26, 2022 (edited) Thanks to some of the other threads on anchor links, I got mine up and running for the most part. The problem is, they're overshooting their target by a good margin on every one. Can someone tell me what I'm missing? This is the code block I have on the page Heres the page : www.thetenmg.com/event Also, how do i make it so the menu can be collapsed to the side if they dont want to use it? This is the code block on the page to get the links visible on the right <ul class="tp-float-buttons"> <li><a href="#WHAT">WHAT</a></li> <li><a href="#WHO">WHO</a></li> <li><a href="#WHEN">WHEN</a></li> <li><a href="#WHERE">WHERE</a></li> <li><a href="#SPONSOR">SPONSOR</a></li> <li><a href="#GUEST">GUEST LIST</a></li> </ul> <style> ul.tp-float-buttons { position: fixed; top: 15%; right: 3px; z-index: 999; list-style: none; padding-left: 0; margin: 0; } ul.tp-float-buttons a { color: white; background-color: black; padding: 3px; margin-bottom: 2px !important; display: inline-block; min-width: 125px; text-align: center; font-size: smaller; top: 125px; position: relative; } </style> And this is the CSS code i had pertaining to it: html { scroll-behavior: smooth; scroll-margin: 300px; } .anchor { display: block; position: relative; top: -150px; visibility: hidden; #WHAT {top: -250px;} } and finally this is the code block i put in the very top of each section for the anchor links to refer to: <div ID="GUEST"></div> and <div ID="WHEN"></div> and <div ID="WHO"></div> etc etc Edited November 26, 2022 by LeauxFi clarification Link to comment
Beyondspace Posted November 26, 2022 Share Posted November 26, 2022 3 hours ago, LeauxFi said: Thanks to some of the other threads on anchor links, I got mine up and running for the most part. The problem is, they're overshooting their target by a good margin on every one. Can someone tell me what I'm missing? This is the code block I have on the page Heres the page : www.thetenmg.com/event Also, how do i make it so the menu can be collapsed to the side if they dont want to use it? <ul class="tp-float-buttons"> <li><a href="#WHAT">WHAT</a></li> <li><a href="#WHO">WHO</a></li> <li><a href="#WHEN">WHEN</a></li> <li><a href="#WHERE">WHERE</a></li> <li><a href="#SPONSOR">SPONSOR</a></li> <li><a href="#GUEST">GUEST LIST</a></li> </ul> <style> ul.tp-float-buttons { position: fixed; top: 15%; right: 3px; z-index: 999; list-style: none; padding-left: 0; margin: 0; } ul.tp-float-buttons a { color: white; background-color: black; padding: 3px; margin-bottom: 2px !important; display: inline-block; min-width: 125px; text-align: center; font-size: smaller; top: 125px; position: relative; } </style> And this is the CSS code i had pertaining to it: html { scroll-behavior: smooth; scroll-margin: 300px; } .anchor { display: block; position: relative; top: -150px; visibility: hidden; #WHAT {top: -250px;} } I think the reason is the header get over the anchor link so you target is hidden after header. We need to add some addition space for anchor link. Currently I find that: the code block for id #what have 2 elements: div and a element. We should remove the a element, keep only the div and add class on it The other code block is missing the class anchor Kindly change the code block, the code should go well BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment