Jump to content

Fixed Background

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Hey people,

 

I am using Code Injection to keep my page background image fixed while the sections move over the top. It is working great on desktop view, but doesn't seem to work on mobile view. Would anyone be able to let me know what I am missing with this... (p.s. I'm not super knowledged with coding. This website was made through self teaching mostly via youtube and Chatgpt. haha)

<style>
  .header, #footer-sections{
    display:none !important;}

#page{
background-image:url(https://images.squarespace-cdn.com/content/6486db2ea9f57144972f519e/ddab9b56-c024-4210-a0f7-8882c5aafb48/Rise+Up+Background.jpeg?content-type=image%2Fjpeg);
background-size: 100%;
  background-attachment:fixed !important;
}

/* Make the page section backgrounds transparent */
#page .page-section {
background: transparent!important
}
#page .page-section .section-background {
background: transparent !important;
}


.section-border{opacity:0!important}
  
</style>

 Any help would be super appreciated.

  • Replies 5
  • Views 2.4k
  • Created
  • Last Reply

Top Posters In This Topic

Posted
1 hour ago, Matt_Lifelancs said:

Hey people,

 

I am using Code Injection to keep my page background image fixed while the sections move over the top. It is working great on desktop view, but doesn't seem to work on mobile view. Would anyone be able to let me know what I am missing with this... (p.s. I'm not super knowledged with coding. This website was made through self teaching mostly via youtube and Chatgpt. haha)

<style>
  .header, #footer-sections{
    display:none !important;}

#page{
background-image:url(https://images.squarespace-cdn.com/content/6486db2ea9f57144972f519e/ddab9b56-c024-4210-a0f7-8882c5aafb48/Rise+Up+Background.jpeg?content-type=image%2Fjpeg);
background-size: 100%;
  background-attachment:fixed !important;
}

/* Make the page section backgrounds transparent */
#page .page-section {
background: transparent!important
}
#page .page-section .section-background {
background: transparent !important;
}


.section-border{opacity:0!important}
  
</style>

 Any help would be super appreciated.

What is the website URL?

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

  • 6 months later...
Posted

Do you know how to disable the effect on mobile only? I'm running into the same issue where I have my homepage just how I want it on desktop, but it looks terrible on iOS. my site is tonerangerguitars.com

Posted
On 8/12/2024 at 1:12 PM, ToneRangerGuitars said:

Do you know how to disable the effect on mobile only? I'm running into the same issue where I have my homepage just how I want it on desktop, but it looks terrible on iOS. my site is tonerangerguitars.com

Change your code

body section[data-section-id="66b99e1c0610407e26877c32"] .section-background {
    background: url('https://static1.squarespace.com/static/665613bd6f16df4119fe55a9/t/66ba84259ebbc3090b01f43d/1723499562439/3332LAYERS+-+Poster+18.25+x+28.25+copy+2.jpg');
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center center !important
}

to this

@media screen and (min-width:768px) {
body section[data-section-id="66b99e1c0610407e26877c32"] .section-background {
    background: url('https://static1.squarespace.com/static/665613bd6f16df4119fe55a9/t/66ba84259ebbc3090b01f43d/1723499562439/3332LAYERS+-+Poster+18.25+x+28.25+copy+2.jpg');
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center center !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.