ngx-image-gallery icon indicating copy to clipboard operation
ngx-image-gallery copied to clipboard

When reactToMouseWheel set to false, page should scroll but it does not

Open thatisuday opened this issue 6 years ago • 6 comments

thatisuday avatar Dec 15 '17 08:12 thatisuday

This bug seems to be present regardless of the 'reactToMouseWheel' setting.

alexharrisdcj avatar Apr 24 '18 21:04 alexharrisdcj

Any workaround on this?

ruant avatar May 18 '18 18:05 ruant

Same issue, when i try scroll on gallery page not react, any solutions?

Artawower avatar Jul 08 '18 12:07 Artawower

Same

TerehinAV avatar Jul 18 '18 10:07 TerehinAV

+1

jaco-terbraak avatar Dec 18 '18 14:12 jaco-terbraak

Workaround:

  1. Create a container around the gallery:
<div #galleryContainer>
  <ngx-image-gallery ... ></ngx-image-gallery>
</div>
  1. Create a ViewChild in the controller:
@ViewChild('galleryContainer')
public galleryContainer: ElementRef;
  1. Make the controller implement AfterViewInit:
public ngAfterViewInit(): void {
  this.hackGalleryScrollEvent();
}
  1. Stop the scroll event propagation, capture it and bubble up:
// TODO: Remove once this bug is fixed (https://github.com/thatisuday/ngx-image-gallery/issues/14)
private hackGalleryScrollEvent() {
  const el = (<HTMLDivElement>this.galleryContainer.nativeElement);
  el.addEventListener('mousewheel', (event) => {
    event.stopPropagation();
  }, {
    capture: true
  });
}

The page should now scroll when you scroll on the gallery.

jaco-terbraak avatar Dec 18 '18 15:12 jaco-terbraak