I've been searching for an updated answer on this topic, but I couldn't find one so I wanted to confirm.
My goal is to achieve a parallax effect using background-attachment: fixed, however I've noticed that it doesn't work on mobile phones and tablets.
As a solution, I decided to disable it by default and use JavaScript to enable it only for larger screen sizes or devices with user agents like iPhone, iPad, etc:
navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone|iPad|iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) || navigator.userAgent.match(/Opera Mini/i) ||
navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/Mobile/i) || navigator.userAgent.match(/Tablet/i);
However, when testing in the responsive design modes in Safari, I've encountered issues where the user agent doesn't update properly and still shows iPhone or iPad even on different screens.
Is there a reliable way to detect if a screen supports background-attachment: fixed?
Alternatively, is there a method to make the parallax effect work on all browsers?
Thanks,
Mark