material2-carousel icon indicating copy to clipboard operation
material2-carousel copied to clipboard

Goes to first slide on window resize

Open ralftar opened this issue 5 years ago • 3 comments

Bug.

To reproduce:

  • Open demo
  • Go to the second slide
  • Resize window

Expected behavior:

  • Resizing window should not trigger sliding

Very annoying on mobile devices where the address bar is shown/hidden automatically.

ralftar avatar Jan 22 '20 11:01 ralftar

Since this is done on purpose, it is easily reversible. I'll take a look, thanks for the feedback.

gbrlsnchs avatar Jan 22 '20 15:01 gbrlsnchs

Great library, but same problem here when triggering full-screen from a slide's content (e.g. when an HTML5 video on a slide needs to be launched in full-screen mode) as this also triggers the "resize" event.

https://github.com/gbrlsnchs/material2-carousel/blob/f7df95d3b4fd2702c603227f3cf854a9e001ed57/projects/carousel/src/lib/carousel.component.ts#L244

  @HostListener('window:resize', ['$event'])
  public onResize(event: Event): void {
    // Reset carousel when window is resized
    // in order to avoid major glitches.
    this.slideTo(0);
  }

@gbrlsnchs can you please tell me, do these problems still need to be addressed and what kind of problems are they? I would be interested to take a look and submit a PR, if that's ok.

jovankrunic avatar Feb 03 '20 16:02 jovankrunic

Can we reverse it, or will it lead to major glitches? Can they be mitigated in other ways?

ralftar avatar May 24 '20 10:05 ralftar