Jump to content

Sticky code blocks?

Recommended Posts

Site URL: https://weareteller.com/sandbox

How do I turn a code block into a sticky item?

I'm using the following code and noticing it works with other block types, but not code blocks:

.code-block {
    position: sticky;
    position: -webkit-sticky;
    top: 100px !important;
}

My guess has to do with how position: sticky handles content inside of wrappers, but I'm not sure.

I'd like the right side column (text inside a code block) to stick as a visitor scrolls down a page. 

Screen Shot 2021-09-24 at 12.53.54 PM.png

Edited by gregbarbosa
fixing text
Link to comment
On 9/24/2021 at 11:55 PM, gregbarbosa said:

Site URL: https://weareteller.com/sandbox

How do I turn a code block into a sticky item?

I'm using the following code and noticing it works with other block types, but not code blocks:

.code-block {
    position: sticky;
    position: -webkit-sticky;
    top: 100px !important;
}

My guess has to do with how position: sticky handles content inside of wrappers, but I'm not sure.

I'd like the right side column (text inside a code block) to stick as a visitor scrolls down a page. 

Screen Shot 2021-09-24 at 12.53.54 PM.png

try

#block-yui_3_17_2_1_1632403820243_21594 +.row .span-4 {
  position: sticky;
  top: 100px !important;
}
#collection-614dfddd7a19a10a3fcc2518 .site-wrapper {
  overflow: visible !important;
}

 

Edited by bangank36

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

image.thumb.png.7dcaf78822bc813f1c9f49020f861ef8.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
4 hours ago, bangank36 said:
#block-yui_3_17_2_1_1632403820243_21594 +.row .span-4 {
  position: sticky;
  top: 100px !important;
}
#collection-614dfddd7a19a10a3fcc2518 .site-wrapper {
  overflow: visible !important;
}

@bangank36 that worked! Thank you. Targeting the span and setting overflow to visible was what I missing!

Edited by gregbarbosa
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.