kvendrik/responsive-images.js

Use width of <img> parent, rather than viewport

Closed this issue · 2 comments

Firstly, awesome plugin, will be adding it to my framework.

I was wondering if it would be possible to use the width of the images parent container rather than the width of the viewport?

I ask this because, like a lot of people, I use a grid system, and more often than not the image on a mobile (one column parent) is wider than that being served to desktops (ie 1 out of 4 columns, approx 23% of the viewport, about 260px @1140px wide)

Would be great as an option, or a forked repo

TY Paul

Fixed for the next release which currently lives in the develop branch. Thanks for pointing this out 👍.

At further thought I decided to remove the feature mentioned above since it's probably a better idea to calculate everything based on the viewport and then place an image that matches the size of the grid column, just like CSS media queries would work.