anselmh / object-fit

Polyfill (mostly IE) for CSS object-fit property to fill-in/fit-in images into containers.
MIT License
996 stars 93 forks source link

Initialize after window load #3

Closed ghost closed 10 years ago

ghost commented 10 years ago

With a simple check of document.readyState === 'complete', the plugin could work even after the page is loaded.

anselmh commented 10 years ago

Hi, thanks for raising this feature-request. Could you point out what benefit is has and if the performance will not be affected by this change? Thank you. :)

ghost commented 10 years ago

The benefit is that it would work if you load the plugin asynchronously (e.g. with Require.js). The performance should not be an issue, since if you omit this part, the plugin does not perform at all (when being loaded after window load). I hope this makes sense.

By the way, I checked the other object fit polyfills and this is by far the best (excerpt for this minor issue).

Schepp commented 10 years ago

Excellent suggestion. I just updated the library accordingly: https://github.com/anselmh/object-fit/releases

ghost commented 10 years ago

Awesome! Thanks a lot.