dinbror/blazy

Option to ignore horizontal, load invisible and force load .

AbhishekNafdey opened this issue · 1 comments

Hi,

I am using this plugin and its working great for me . Thanks ! .

A few things that i found useful and missing are -
1 - When a container has horizontal scroll , images do not get loaded till we scroll the page as horizontal scroll is on the div. I understand that this can be achieved using the container option but if i need to use a single instance of this plugin it becomes hard. Instead we can have a option to skip horizontal cheek .What I did in the older version was as follows -
return (
// inside horizontal view
(options.skipHorizontal || rect.left >= 0
&& rect.right <= winWidth + options.offset )
&&
(
// from top to bottom
rect.top >= 0 ……

2 – For issues with hidden images like in tabs, I see you have added a force variable in load. This makes the developer call it when every time its needed. Instead we could add this too as an option to load hidden images.
function loadImage(ele){
// if element is visible
if(options.loadInvisible || (ele.offsetWidth > 0 && ele.offsetHeight > 0)) {
…….

3 – A force parameted in load can be very useful too. In situation when I need to force load an image o matter in view port or not .Kind of preloading in carousels .For this I used the force variable as following.
Blazy.prototype.load = function(element ,force){
if(force || !isElementLoaded(element)){

It could be great if you add these options as they can give more flexibility depending on different scenarios to lot of us.

Fixed 2/3 of your requests in v. 1.5.0. Thanks