box / box/viewer.js

Crocodoc.LAYOUT_PRESENTATION on onscroll event scrollTo next/previous page

Open
#138 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
333
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Hi, is it possible to bind an onscroll event and based on that use scrollTo to scroll te the next/previous page when using Crocodoc.LAYOUT_PRESENTATION? Something like this:

``` js
var initPosition = document.body.scrollTop;

window.bind('onscroll', function(event) {
var newPosition = document.body.scrollTop;

if (newPosition > initPosition) {
// scroll down
event.preventDefault();
viewer.scrollTo(Crocodoc.SCROLL_NEXT);
} else {
// scroll up
event.preventDefault();
viewer.scrollTo(Crocodoc.SCROLL_PREVIOUS);
}
});
```

Contributor guide

Open the contributing guide

Research direction

Start by examining the viewer.scrollTo entry point and Crocodoc.LAYOUT_PRESENTATION behavior described in the issue, then reproduce the onscroll scenario with the provided example. Define the expected next/previous-page behavior and verify that scrolling in either direction consistently triggers the intended page transition without leaving the viewer in an unusable state.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.