Jump to content

Paralax scroll for image works on desktop but not mobile

Go to solution Solved by tuanphan,

Recommended Posts

I created a paralax scroll, with this piece of CSS: 

section[data-section-id="section-id-here"]
.section-background {
    background: url('custom-file-image-here');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

works like a charm on a desktop. however, there is no parallax on mobile. the photo on mobile looks awful as it's very zoomed in. does anyone know how to fix this? 

Edited by lilpruks
needed to add more tags
Link to comment
  • Replies 5
  • Views 1k
  • Created
  • Last Reply

Top Posters In This Topic

37 minutes ago, tuanphan said:

Hi,

background-attachment: fixed won't work on iOS. iOS doesn't support this attribute

You can consider disable effect on mobile

okay, do you know how I add that to the CSS? and if I disable parallax for mobile, I need to ensure the image appears full size on mobile? Thanks

Edited by lilpruks
Link to comment
22 hours ago, lilpruks said:

okay, do you know how I add that to the CSS? and if I disable parallax for mobile, I need to ensure the image appears full size on mobile? Thanks

Can you share link to page where you use this effect? We can check/give code easier

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
On 8/12/2023 at 5:26 AM, tuanphan said:

Can you share link to page where you use this effect? We can check/give code easier

Pineslandscaping.ca

password: Pineslandscaping

the effect is on multiple pages throughout the site

Edited by lilpruks
Link to comment
  • Solution
On 8/10/2023 at 7:48 AM, lilpruks said:

I created a paralax scroll, with this piece of CSS: 

section[data-section-id="section-id-here"]
.section-background {
    background: url('custom-file-image-here');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

works like a charm on a desktop. however, there is no parallax on mobile. the photo on mobile looks awful as it's very zoomed in. does anyone know how to fix this? 

You can change code to this, to force it run on desktop only

@media screen and (min-width:992px) {
section[data-section-id="section-id-here"] .section-background {
    background: url('custom-file-image-here');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}
}

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.