Skip to content

Option to ignore horizontal, load invisible and force load . #45

Closed
@AbhishekNafdey

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions