Responsive image
-
Hello,
I’ve been happily using Lazy Load XT so far, but I’m just updating to WP 4.4 and therefore, I’ve got a few questions regarding the srcset workaround and the sizes attribute :1- While digging in the jquery.lazyloadxt.srcset.js code, I don’t really get what you’re doing with the devicePixelRatio. To me, it doesn’t really do anything at the moment. What would be nice would be that a device with a devicePixelRatio==2 and a width==375 loads an image with a width>=750, but it doesn’t do that. I’ve tried a quick and dirty fix which is just under
viewport = { w: window.innerWidth || documentElement.clientWidth, h: window.innerHeight || documentElement.clientHeight, x: window.devicePixelRatio || 1 };
I add this
viewport = { w: viewport['w'] * viewport['x'], h: viewport['h'] * viewport['x'] };
And now, it works. Maybe I’m missing some other workcase though…
2- The sizes attribute of the img is not taken into account isn’t it ? If I have in my code something like
sizes="(max-width: 1080px) 80vw, 1080px"
The 80vw is ignored. It always behave as if it was
sizes="(max-width: 1080px) 100vw, 1080px"
I understand that this one is more tricky to work out though.Thanks for your help.
- The topic ‘Responsive image’ is closed to new replies.