angular2-image-gallery: this.render() not showing gallery unless i resize the window

First, I would like to congratulate you on the quality of this gallery and thank you for sharing with the community.

I just installed the component, it works but… the gallery doesn’t render unless I resize the screen.

I pinpointed the problem to the this part :

// twice, single leads to different strange browser behaviour this.render(); this.render();

I even tried using setTimeout with 5 seconds timeout, sometimes it works, sometimes it doesn’t.

Again, when I change resize the window it works just fine.

Do you have any idea how to fix this ?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 15 (2 by maintainers)

Most upvoted comments

I´ve had the same problem. The thumbnails in the invisible part of the page doesn´t get rendered after they got scrolled into view. I started a new small project with angular 8.2 and material. In my case the problem was that I didn´t receive a scroll event and therefore the code for loading the images wasn´t called. Following line added in ngOnInit() resolved my problem:

window.addEventListener('scroll', this.triggerCycle.bind(this), true);

In ngOnDestroy I just remove the listener.