dinbror / blazy

Hey, be lazy! bLazy.JS is a lightweight pure JavaScript script for lazy loading and multi-serving images. It's working in all modern browsers including IE7+.
http://dinbror.dk/blazy
MIT License
2.63k stars 356 forks source link

Add a method to change options post initialisation #100

Closed gajus closed 8 years ago

gajus commented 8 years ago

Specifically, I'd like to be able to control the offset option after constructing Blazy instance.

gajus commented 8 years ago

The use case:

dinbror commented 8 years ago

hey @gajus

That's already possible. If you save blazy as a variable you can change the options on the variable whenever you want:

var bLazy = new Blazy();
...
bLazy.options.offset = 100;
gajus commented 8 years ago

@dinbror Thank you for pointing this out. I figured it eventually by looking at the source code, though I was expecting to see a setter. Controlling options in this manner can lead to all sorts of unexpected mutations.

dinbror commented 8 years ago

@gajus: yes it also isn't build for that. No setters to keep filesize small