Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Scrolling text over a fixed background within a section


nsdoyle

Question

Site URL: https://www.purehomeoffice.com/aspire-1

Heya

I'd like to create a section with a fixed height of the window / media screen that scrolls through all the available text / content before proceeding to the next section.

I found this bit of code that I believe will do what I want, but I don't know exactly how to implement it.

https://codepen.io/aakhya/pen/QJWovp

I attached a video to show what I'd like to achieve.

 

Using 7.1, btw.

Link to post
  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

Can't believe it was that easy. That did the job marvelously. Thank you!

Posted Images

6 answers to this question

Recommended Posts

  • 0
Posted (edited)

Are you trying to do it to all of the sections?

Try adding this to design -> custom CSS

.section-background {
    position: fixed !important;
    left:unset !important;
}

 

Edited by rwp

Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Link to post
  • 0

Guess I spoke too soon.

I tried to add another section further down the page and the image from that section takes over all the way back to the top.

Link to post
  • 0

Remove the code from above and give this a try:

.section-background img {
    position: fixed !important;
}

 

Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Link to post
  • 0

That sort of fixed it. It's not taking up the rest of the page now, but now the second section's background image doesn't display.

Screen Shot 2020-07-09 at 9.16.49 PM.png

Link to post
  • 0

You could set the background of the div manually to the URL of the image, and then hide the image tag. That's what they did in the link you posted.  You would need to manually do it for each section.

[data-section-id="5f0756efed03a802582b95aa"] .section-background img {
  display:none;
}

[data-section-id="5f0756efed03a802582b95aa"] .section-background {
  background: url('https://images.squarespace-cdn.com/content/v1/5ee0ee00a0a12e14f700c502/1594316294831-H3VJXJTZAZNJI3G2QK5N/ke17ZwdGBToddI8pDm48kBQ_OmUn0XNjqwyBYOIFwXV7gQa3H78H3Y0txjaiv_0fDoOvxcdMmMKkDsyUqMSsMWxHk725yiiHCCLfrh8O1z4YTzHvnKhyp6Da-NYroOW3ZGjoBKy3azqku80C789l0p5uBJOnOmCWBN4JfYsIDyRB3ELHLLET9s1anQygWAMDSh6zbPa8Vo37A4r2-aOSIQ/IMG_1660.jpeg?format=2500w');
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

 

Edited by rwp

Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Link to post

Create an account or sign in to comment

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


×
×
  • Create New...