Jump to content

How to make my text block (+ image block) into a sticky element with CSS?

Recommended Posts

Site URL: https://www.jeannemarie.space/

I currently have two pieces of code in place right now to make a sticky effect, but I have some issues I wanted to fix if possible!

 

*current code

@media screen and (min-width:768px) {
.fe-block.fe-block-yui_3_17_2_1_1660163627625_1012844 {
    position: sticky;
    top: 0;
    position: -webkit-sticky;
    z-index: 999;
}
}

@media screen and (min-width:768px) {
.fe-block.fe-block-yui_3_17_2_1_1660163627625_717246 {
    position: sticky;
    top: 0;
    position: -webkit-sticky;
    z-index: 999;
}
}

 

The element(s) I want to be "sticky" are the yellow circle (which is an image block) and the "my work" text (which is a text block overlapping the circle).

 

First, I want the combined element to start moving with me in the middle of the page as you begin to scroll, not start moving at the top of the page like it is now, because it interferes with my sticky navigation menu and just doesn't have the landing effect I want that way.

 

Second, I also want to know if there's a way I can make the two elements stay together while they scroll and not break apart like they are now when they move. If the simple solution is to make this a single element as a button instead of custom text and image background then that is fine. 

 

Last and most important thing I want to try to accomplish is for the sticky effect to end within the same section right after the " I collaborate with small businesses..." paragraph.

 

P.S. I also want this effect on mobile, but my current code doesn't seem to do that...

 

Screen Shot 2022-08-11 at 12.38.35 PM.png

Screen Shot 2022-08-11 at 12.38.51 PM.png

Link to comment
  • Replies 0
  • Views 535
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

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.