Skip to content

Commit

Permalink
bugfix: scroll momentum increase over fixed elements
Browse files Browse the repository at this point in the history
For more info see #164
  • Loading branch information
janpaepke committed Oct 7, 2014
1 parent 097964c commit ec6f5b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ $ node dev/build
```

## Test ScrollMagic
ScrollMagic comes with a test suite that makes sure that everything works as expected after changing the source code.
ScrollMagic comes with a test suite that makes sure that everything works as expected after changing the source code.
**NOTE**: The main scene methods have not been fully specced out yet, but will be added in the future.
To start the test suite call:
```Shell
$ npm test
```
It will stay active an automatically restart the test cycle whenever you change something.
It will stay active an automatically restart the test cycle whenever you change something.
*Tip:* In case you don't know – to quit the process use ctrl+c.

To run only a single test cycle and exit after use this:
Expand Down
2 changes: 1 addition & 1 deletion dev/src/class.ScrollMagic.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
** `1` => errors
** `2` => errors, warnings
** `3` => errors, warnings, debuginfo
* @param {boolean} [options._refreshInterval=100] - Some changes don't call events by default, like changing the container size or moving a scene trigger element.
* @param {boolean} [options.refreshInterval=100] - Some changes don't call events by default, like changing the container size or moving a scene trigger element.
This interval polls these parameters to fire the necessary events.
If you don't use custom containers, trigger elements or have static layouts, where the positions of the trigger elements don't change, you can set this to 0 disable interval checking and improve performance.
*
Expand Down
7 changes: 4 additions & 3 deletions dev/src/class.ScrollScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,13 @@
};

/**
* Is called, when the mousewhel is used while over a pinned element.
* If the scene is in fixed state scroll events used to be ignored. This forwards the event to the scroll container.
* Is called, when the mousewhel is used while over a pinned element inside a div container.
* If the scene is in fixed state scroll events would be counted towards the body. This forwards the event to the scroll container.
* @private
*/
var onMousewheelOverPin = function (e) {
if (_parent && _pin && _state === "DURING") { // in pin state
if (_parent && _pin && _state === "DURING" && !_parent.info("isDocument")) { // in pin state
e.preventDefault();
_parent.scrollTo(_parent.info("scrollPos") - (e.originalEvent.wheelDelta/3 || -e.originalEvent.detail*30));
}
};
Expand Down

0 comments on commit ec6f5b7

Please sign in to comment.