bbc / Imager.js

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

adding Imager.add method #92

Closed VarinderS closed 9 years ago

VarinderS commented 10 years ago

Ability to add elements after initialization.

var imager = new Imager(options);
imager.add(anotherDomElement);
imager.add('.element');

Possible use case: loading slider images on demand.

var imager = new Imager(options);
var slider = new SomeSlider(options);
slider.on('slide', function(element) { imager.add(element); });
thom4parisot commented 10 years ago

Nice use case :-)

I guess the constructor and the add method should share the same code/element signature. The constructor is doing the same thing except it adds elements to an empty array.