Jump to content

Parallax effect with image not moving

Recommended Posts

Hi, I am looking to create the effect similar to the opening banner here: https://www.casareia.com/

No website to show you in particular, I want the effect on several of my websites.

I have used the following code to make the section sticky: 

 

@media screen and (min-width: 768px) {
section[data-section-id=""] {
position: sticky!important; 
top: 0px!important

html {
scroll-behavior: smooth

  } 

 

However, with it, the text on the slide becomes sticky as well, whereas I only want the background sticky, not the text on the background. Is there any way to customise this? 

Link to comment
  • 1 month later...
On 3/19/2023 at 4:41 AM, tuanphan said:

You haven't entered id yet

section[data-section-id=""]

Use this tool to find data section id

https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff?hl=en

hey tuanphan, I implemented this on my website: https://violin-aqua-9h9p.squarespace.com/
password: HELPME

I was wondering if Im able to consolidate the code in the custom css section. I implemented sticky parallax to my entire homepage and it came out to around 60 lines of code. Im sure Ill be able to add the section id somewhere in one block of code but i have no idea where.

Thank you!

Link to comment
9 hours ago, pietro445 said:

hey tuanphan, I implemented this on my website: https://violin-aqua-9h9p.squarespace.com/
password: HELPME

I was wondering if Im able to consolidate the code in the custom css section. I implemented sticky parallax to my entire homepage and it came out to around 60 lines of code. Im sure Ill be able to add the section id somewhere in one block of code but i have no idea where.

Thank you!

What is your problem?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
3 hours ago, tuanphan said:

What is your problem?

I just want to know if there's a way of combining this code. For example,
Here is the code for making a section position sticky, I included two sections out of the seven that I used on my homepage.

@media screen and (min-width: 0px) {
section[data-section-id="642dbb1f86b2a117d2043598"] {
position: sticky!important; 
top: 0px!important
} 
html {
scroll-behavior: auto
} 
  }

@media screen and (min-width: 0px) {
section[data-section-id="643b0d6f597bb324b62f8b93"] {
position: sticky!important; 
top: 0px!important
} 
html {
scroll-behavior: auto
} 
  }

Would it be possible to combine them somehow so that I won't have to use as much code?
something like this for example:
 

@media screen and (min-width: 0px) {
section[data-section-id="642dbb1f86b2a117d2043598"] & section[data-section-id="643b0d6f597bb324b62f8b93"] {
position: sticky!important; 
top: 0px!important
} 
html {
scroll-behavior: auto
} 
  }

 

Link to comment

You can change to this shorter code

section[data-section-id="642dbb1f86b2a117d2043598"], section[data-section-id="643b0d6f597bb324b62f8b93"]  {
  position: sticky !important; 
  top: 0px !important;
} 
html {
scroll-behavior: auto
} 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.