bbc / Imager.js

Responsive images while we wait for srcset to finish cooking
Apache License 2.0
3.84k stars 224 forks source link

[READY] availableWidths as a function #33

Closed thom4parisot closed 10 years ago

thom4parisot commented 10 years ago

Alternative implementation of #21. It adds 2 more commits that enables availableWidths to be either an array of values or a function.

var imgr = new Imager({ availableWidths: [8, 16, 24, …] });

//equiv to
var imgr = new Imager({
  availableWidths: function(image){
    return image.clientWidth - image.clientWidth % 8 + (1 * (image.clientWidth % 8 ? 8 : 0));
  }
});

thom4parisot commented 10 years ago

This one is for you @maslen :sunglasses:

Integralist commented 10 years ago

@oncletom this is a comment just for my own purposes (when I check here again later) that there is one issue outstanding which relates to how the 1030 clientWidth should be handled (I personally think a 1024 image should be loaded as it's nearest, and not revert to default 320)

Integralist commented 10 years ago

@oncletom this looks good to me, but it can't be merged at the moment so once that build is passing then just let me know and I'll press the merge button :-)

thom4parisot commented 10 years ago

Rebased :-)

thom4parisot commented 10 years ago

Brilliant thanks @Integralist :-)

Integralist commented 10 years ago

@oncletom no problem, sorry it's taking so long between comments to get back to you. Just busy busy busy :-/ but getting there! :-)

thom4parisot commented 10 years ago

I'll now put some efforts to propose an updated README documentation to cover the new features so as it could be released in master.

Do you think about something else before we can reach this level of satisfaction?

PS: no problem for the busy-ness :-) We all are I think.

Integralist commented 10 years ago

@oncletom no I think this is probably a good point to get some good documentation in place so we can hook it all back into master :-)