epub.js icon indicating copy to clipboard operation
epub.js copied to clipboard

Continuous Manager inside an element that is scrolling that is not the viewport?

Open benlieb opened this issue 1 year ago • 0 comments

It appears that this code (node_modules/epubjs/lib/managers/continuous/index.js):

  observeIfChapterIsInView(view) {
    const observer = new IntersectionObserver(entries => {
      if (entries[0].isIntersecting === true) {
        setTimeout(() => {
          if (this.readingDirection === 'backward') {
            this.observeMovingBack();
          } else {
            this.observeMovingForward();
          }
        }, 500);
      }
    }, {
      threshold: [1]
    });
    observer.observe(view.element);
  }

Means that the continuous scrolling only works when the scrolling element is is the viewport (default since no root is passed explicitly).

Is there an easy way for me to get this to work when the EPUB is rendered into an element that is scrolling that is not the viewport?

benlieb avatar Feb 13 '24 19:02 benlieb