DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Arnav Bansal
Arnav Bansal

Posted on

Using parallax scrolling on mobile?

I'm trying to use background-attachment: fixed. On desktop, this works as expected. But on mobile, it's broken. The background image moves with the page.

I've read workarounds that include using position: fixed, but if it's disabled on mobile, there must be a reason for it.

Here's an example of a page that uses the parallax scrolling effect: https://www.w3schools.com/howto/tryhow_css_parallax_demo.htm

Top comments (1)

Collapse
 
edisonywh profile image
Edison Yap

caniuse.com/#search=Background-att...

Suppose you tried on iOS? Doesn't work on iOS apparently.

A quick Google around says that it's disabled intentionally for performance reasons

๐ŸŒš Friends don't let friends browse without dark mode.

Sorry, it's true.