background attachment: fixed not working on mobile browser | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

background attachment: fixed not working on mobile browser

background-attachment: fixed is not supported on many mobile phone browsers. How could it work?

31st Aug 2017, 10:55 AM
Shogun
Shogun - avatar
3 Answers
+ 9
I've read to quick: you're tallking about 'fixed' property of 'background-attachment' property, and I've answered for 'position' ^^ Rather try the Css solution in the first answer of this stackoverflow thread: https://stackoverflow.com/questions/26372127/background-fixed-no-repeat-not-working-on-mobile (no tested, but sound logical to work ;))
31st Aug 2017, 11:28 AM
visph
visph - avatar
+ 6
You could use this <meta> tag to make 'fixed' positionned element well working on mobile: <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"> ... but, it will disable user ability to zoom the page ^^ However, you could try a JS workaround (but JS could be disabled by user, or even unavailable on certain browsers): http://bradfrost.com/blog/mobile/fixed-position/
31st Aug 2017, 11:22 AM
visph
visph - avatar
+ 4
Thank you :) It works like a charm.
31st Aug 2017, 11:34 AM
Shogun
Shogun - avatar