Jump to content

Sticky element not working

Go to solution Solved by Beyondspace,

Recommended Posts

Posted

Hi im having issue with a sticky element not working.  Not sure what the problem is. below is the code and a screengrab of whats happening.  any ideas?

 

https://blueberry-carrot-xawg.squarespace.com/narrative-copy-1

pw codeblock

 

<html>
<div id="sidetitle1">
    <p style="letter-spacing:35px; opacity:100%; color:white; font-size:150%; font-family:lato; font-weight:600;">NARRATIVE</p>
  </div>
</html>

<style>
  #sidetitle1 {
  display: flex;
  position: sticky !important;
  position: -webkit-sticky !important;
  text-shadow: 1px 1px 10px #000 !important;
  writing-mode: vertical-lr; 
  text-orientation: upright;
  width: 25px;
  height: 100px;
  top:0px !important;
  z-index: 99999;
}
</style>

 

Posted
56 minutes ago, joshuaechevarriadop said:

Hi im having issue with a sticky element not working.  Not sure what the problem is. below is the code and a screengrab of whats happening.  any ideas?

 

https://blueberry-carrot-xawg.squarespace.com/narrative-copy-1

pw codeblock

 

<html>
<div id="sidetitle1">
    <p style="letter-spacing:35px; opacity:100%; color:white; font-size:150%; font-family:lato; font-weight:600;">NARRATIVE</p>
  </div>
</html>

<style>
  #sidetitle1 {
  display: flex;
  position: sticky !important;
  position: -webkit-sticky !important;
  text-shadow: 1px 1px 10px #000 !important;
  writing-mode: vertical-lr; 
  text-orientation: upright;
  width: 25px;
  height: 100px;
  top:0px !important;
  z-index: 99999;
}
</style>

 

149486028_ScreenRecording2022-12-07at8_00_47AM.mov

How do you want it to sticky? Do you mean fixing this element on a fixed position?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted

Try changing this line:

position: sticky !important;

to:

position: fixed;

And adjust the top property to suit, probably about forty pixels.

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

📈 SEO Space (Referral link)
Ⓜ️ 
Will Myers' Plugins & Tutorials (Referral link)
 🔌 Ghost Squarespace Plugins (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Posted
7 hours ago, Beyondspace said:

How do you want it to sticky? Do you mean fixing this element on a fixed position?

I'd love to have it scroll down until a certain point and then stop to introduce a new section that does the same action

  • 1 year later...
Posted

Thank you so much, BeyondSpace – this code worked perfectly for me (with my own .fe-block, of course)! For those using the amazing (and indispensable) Squarespace ID Finder extension for Chrome, you can just copy your desired block's ID, delete the #, and add .fe- to the beginning everything remaining to target your .fe-block.

I was running into this issue in a single usage of my sticky code for a reason that I haven't quite been able to decipher (I have two other seemingly identical sections on the same page – left aligned headers sticking to scroll alongside their respective accordions  – that are working without the need for the height to be defined). A caveat for future readers that I needed to substantially increase the number after height for my site – to 280px(!) – so don't be afraid to really fiddle with that number to get your desired result 🙂.

  • 9 months later...
Posted (edited)

Hmm, placing '.fe-' in front of my block id doesn't seem to produce any results.

When I use #block-yui, it will recognize 'fixed' but not 'sticky,' and when I apply ".fe-block" it won't recognize either.

Edited by mcdufrechou

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.