wallpaper: scroll on ios, fixed otherwise

This commit is contained in:
Philippe Loctaux 2023-06-03 18:06:42 +02:00
parent 17bf689f2f
commit 602bc0ded8

View file

@ -10,9 +10,33 @@ const [location1, ...locationRest] = wallpaper.location.split(",");
const location2 = locationRest.join(","); const location2 = locationRest.join(",");
--- ---
<style>
/* Fixed background when scrolling in tailwind
* Disabled on iOS devices
* https://tailwindcss.com/docs/background-attachment
* https://stackoverflow.com/a/60220757/4809297
*/
@supports (-webkit-touch-callout: none) {
/* CSS specific to iOS devices */
#wallpaper {
background-attachment: scroll;
}
}
@supports not (-webkit-touch-callout: none) {
/* CSS for other than iOS devices */
#wallpaper {
background-attachment: fixed;
}
}
</style>
<div class="bg-gradient-to-r from-red-900 via-teal-900 to-fuchsia-900"> <div class="bg-gradient-to-r from-red-900 via-teal-900 to-fuchsia-900">
<div <div
class="relative text-white w-full h-almostscreen bg-center bg-scroll bg-cover" id="wallpaper"
class="relative text-white w-full h-almostscreen bg-center bg-cover"
style=`background-image: url(${wallpaper.file});` style=`background-image: url(${wallpaper.file});`
> >
<!-- Content inside --> <!-- Content inside -->