Jump to content

Create fixed background images as sections scroll by

Go to solution Solved by tuanphan,

Recommended Posts

Posted (edited)

Hi, I'm trying to add CSS code to create fixed background images that are revealed (like looking through a window) as a visitor scrolls down. Here is an example of what I'm trying to reproduce on my site: https://wggcharliedawn.showit.site/

The only thing I've been able to sort of do so far is make certain sections sticky and others aren't. This is close to the desired effect but the image scrolls -- instead of just appearing -- and sticks to the top until the next scrolling section covers it. Thanks.

Edited by CaminoQuest
  • Replies 3
  • Views 990
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

Hey Tuanphan, thanks for your response. go to https://caminoquestpreview.squarespace.com/ PW: DEMO. Scroll down to 2025 Pilgrimages (scrolling marquee) and you'll see May 11-17 pilgrimage. Click on Explore this Route button and it will take you to the page in question. Once here you'll see I have 3 sticky sections that I would love to change to fixed image. Thanks! 

May 2025.png

  • Solution
Posted
On 8/29/2024 at 12:46 AM, CaminoQuest said:

Hey Tuanphan, thanks for your response. go to https://caminoquestpreview.squarespace.com/ PW: DEMO. Scroll down to 2025 Pilgrimages (scrolling marquee) and you'll see May 11-17 pilgrimage. Click on Explore this Route button and it will take you to the page in question. Once here you'll see I have 3 sticky sections that I would love to change to fixed image. Thanks! 

May 2025.png

Try this code for Galician section

section[data-section-id="66cb5c8d3d670b2996b9870b"] {
  & {
      position: relative !important;

  }
  img {
      visibility: hidden;
  }
  .section-border {
      background-image: url(https://images.squarespace-cdn.com/content/v1/66ba2c75e4355a5823e54ffe/54d78f8a-b0fd-4d70-9557-9478bc8ec0ae/Galicia+Horreos.png?format=2500w);
      background-size: cover; 
      background-color: transparent !important;
      background-attachment: fixed;
  }
  .section-background, section {
      background-color: transparent !important;
  }
}

 

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!)

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.