Using this behavior you do get a onScroll function with the current scroll position.
$ bower install --save daKmoR/grain-scroll-behavior
Import the package.
<link rel="import" href="/bower_components/grain-scroll-behavior/grain-scroll-behavior.html">
Create your element using this behavior utilizing onScroll.
class GrainResponsiveBehaviorExample extends GrainScrollBehavior(Polymer.Element) {
ready() {
super.ready();
this.scrollLoop(); // init/start the behavior
}
onScroll(scrollTop) {
// your code for example something like this
if (scrollTop > this.vhToPx('10vh')) {
// ...
}
}
}
For more information, see the API documentation.
First, make sure you have the Polymer CLI installed.
- View the Element via
polymer serve
- Run tests via
polymer test