Polymer behavior that allows to define a scroller target
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github Create CODEOWNERS Jan 24, 2018
demo Manual updates for 3.0 Jun 28, 2018
test Fix format Aug 16, 2018
.gitignore Tedium automated v3 element updates. Aug 16, 2018
.npmignore
.travis.yml Only generate types once on Travis Sep 7, 2018
CONTRIBUTING.md [skip ci] Update contribution guide May 17, 2016
README.md Fix README Jul 17, 2018
bower.json
formatconfig.json Fix formatconfig.json Aug 8, 2018
gen-tsd.json Exclude scroll method from type generation. Aug 14, 2018
iron-scroll-target-behavior.js
manifest.json auto-converted by polymer-modulizer Jun 23, 2018
package-lock.json 3.0.1 Sep 14, 2018
package.json 3.0.1 Sep 14, 2018
wct.conf.json Update WCT config May 23, 2018

README.md

Published on NPM Build status Published on webcomponents.org

IronScrollTargetBehavior

IronScrollTargetBehavior allows an element to respond to scroll events from a designated scroll target.

Elements that consume this behavior can override the _scrollHandler method to add logic on the scroll event.

See: Documentation, Demo.

Usage

Installation

npm install --save @polymer/iron-scroll-target-behavior

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {IronScrollTargetBehavior} from '@polymer/iron-scroll-target-behavior/iron-scroll-target-behavior.js';

class SampleElement extends mixinBehaviors(IronScrollTargetBehavior, PolymerElement) {
  static get template() {
    return html`
      <p>Scrollable content here</p>
    `;
  }

  _scrollHandler() {
    console.log('_scrollHandler', this._scrollTop, this._scrollLeft);
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/iron-scroll-target-behavior
cd iron-scroll-target-behavior
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm