Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background lazy load not working in angular js #74

Open
MukulSinghKumawat opened this issue Dec 30, 2016 · 3 comments
Open

background lazy load not working in angular js #74

MukulSinghKumawat opened this issue Dec 30, 2016 · 3 comments

Comments

@MukulSinghKumawat
Copy link

MukulSinghKumawat commented Dec 30, 2016

bglazyload not working in angular

@benjamincharity
Copy link
Owner

I have personally been unable to get the lazy loading to work within Flickity in any situation; even in the CodePens linked from the Flickity.js docs.

As far as this libraries integration with Flickity goes, it is simply passing an option to the Flickity library.

If someone can provide a working example of lazy loading actually working I can try to track down the issue. I will leave this open since it is a valid issue.

@luigimannoni
Copy link

luigimannoni commented Jan 19, 2017

We had lots of issues with preloading and also lazyloading as well especially if we used a remote server or slow loading images. At the end we did ourselves a preload of the images in an old fashioned way:

export default function preloadImages(urls) {
  // see carousel controller for more info on this method
  const promises = urls.map(url => {
    return new Promise(function (resolve, reject) {
      const img = new Image();
      img.onload = () => resolve(img);
      img.onerror = () => resolve(img);
      img.src = url;
    });
  });

  return Promise.all(promises);
}

Hope it helps

@benjamincharity
Copy link
Owner

Thanks for the tip @luigimannoni! Hopefully it can help someone until this is resolve. Even in the official Flickity codepen demos I couldn't seem to get the lazyloading to work 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants