PricingBlog

Sticky Placement

  • tcg.store-1275463410091556885

    TCG.Store

    1 year ago

    Hi everyone,

    I'm trying to make a sticky sidebar for an app, but unable to get the sticky placement to actually work. I've defined a top margin, set sticky, but no luck.
    1
  • andreasmoller-1275463651741929535

    Andreas Møller

    1 year ago

    You can read more about position: sticky here https://css-tricks.com/position-sticky-2/
    🙏1
  • tcg.store-1275464175010844733

    TCG.Store

    1 year ago

    Thanks for sharing this @Andreas Møller -- i for some reason can't get it to work even when positions defined. Maybe i missed a setting somewhere
  • max.kayr-1275464935224246363

    Max

    1 year ago

    Please share a few screenshots and the desired behavior, then we might be able to help. Where is the element on the screen, what is your configuration, etc
    ❤️1
    🙏1
  • tcg.store-1275465504760270919

    TCG.Store

    1 year ago

    1275465504559075459-CleanShot_2024-08-20_at_10.44.112x.png
  • 1275465599199477913-CleanShot_2024-08-20_at_10.44.432x.png
  • max.kayr-1275468210233278537

    Max

    1 year ago

    What is the behavior that you want to achieve?
  • tcg.store-1275468539301597256

    TCG.Store

    1 year ago

    When a user scrolls this sidebar (cardhouse logo and tng gamez logo) remains sticky on scroll-y
  • max.kayr-1275468763604717602

    Max

    1 year ago

    You mean scrolls within the sidebar? Can you show your element tree?
  • tcg.store-1275469466356027445

    TCG.Store

    1 year ago

    ah good question, i mean when folks scroll anywhere on the page the sidebar remains sticky regardless of the length of the content on the right of the sidebar
  • max.kayr-1275470277739941888

    Max

    1 year ago

    Elements are only sticky within their containers. It looks like there is a div around your sticky element. This will break the behavior
  • tcg.store-1275471225946243072

    TCG.Store

    1 year ago

    oh i see, you can't have nested elements and the top parent sticky?
  • tcg.store-1275471574769864805

    TCG.Store

    1 year ago

    I tried making for example making 1 logo sticky, but no luck 😦
  • lucasg-1275473732286152824

    Lucas G

    1 year ago

    They're already at the top there
  • Where do you want them to be sticky
  • Is the sidebar scrollable
  • tcg.store-1275474651983642762

    TCG.Store

    1 year ago

    sticky to the middle of the page, and the sidebar is currently scrollable
  • tcg.store-1275475666552492144

    TCG.Store

    1 year ago

    finally got it to work, i figured out the problem
  • tcg.store-1275475725939638384

    TCG.Store

    1 year ago

    the sidebar was set to 100% instead of 100vh (the parent div as well)
  • lucasg-1275475741714153675

    Lucas G

    1 year ago

    Make sure you don't have overflow anywhere
    🙏1