I know background images are a poor choice for serving mobile users and I see that responsive bg’s are currenty not supported (currently a feature request).
The site I’m working on is photographic and has full width heros/ctas on hundreds of pages. I’ve done as much as I can to optimise the images but they still deliver the full kbs to mobile users which is in turn trashing the pagespeed score. I’m wondering if anyone has a workaround that I can use in Cwicly?
If you are using consistent semantic global classes on every page, as you are an experienced developer there is a straightforward solution using custom css or a custom stylesheet.
For example, if your hero blocks all have a class of .hero, you can hide the background image using a media query for the mobile breakpoint and target the .hero class with background: none (or whatever other background you need).
There was some mention recently about work being done on this, so it is possible an upcoming release will include it, for now though, some custom CSS is a quick workaround.
You can also vote on this feature request if you want:
You’re too kind - I’m experienced but I had a break for a couple of years and lost most of my skills. I’m currently trying to get up to speed.
Thanks for the link. I copied the file over and can see it on the canvas, but I can’t figure out how to make any changes within Cwicly - I see a couple of others had the same.
Another way to get around this is to use an inline image that is positioned absolutely within the container you would normally have a background image on. This way, you’re able to use “srcset” to adjust the images sizes served at different breakpoints. I find this method preferable and use it almost all the time since there’s not real downside to using it. Additionally, this method also lets you adjust the aspect ratio and focal point at each breakpoint.
@msguerra74 thanks - do you have and example I could have quick look at? I’m trying to find the easiest/laziest way possible because I have a lot of images to work on
I have an ooni oven which is amazing. No matter the weather, we’ve cooked from 36C summer to -10C winter. Don’t think I could ever go back to an indoors cooked pizza again.
This approach works well for changing the output size/resolution of the image on a per breakpoint basis. As it is currently manual and has to be done on a per block basis it is not really optimal for a general purpose solution for hiding images on mobile.
There are ways you can do the same as I showed in the custom code example using Cwicly’s inspector instead, that offer the same level of general applicability, using the custom code approach is probably one of the quickest and most efficient ways to target your existing blocks without requiring any other structural or stylistic changes (assuming you are using reusable global classes of course).