Skip to content

Commit 13e7f6f

Browse files
committed
Merge pull request #1 from PolymerElements/1.0.0
Initial port to 1.0
2 parents f9f2294 + 6acc11c commit 13e7f6f

14 files changed

+1010
-389
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bower_components/

README.md

Lines changed: 62 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,62 @@
1-
2-
<!---
3-
4-
This README is automatically generated from the comments in these files:
5-
core-scroll-threshold.html
6-
7-
Edit those files, and our readme bot will duplicate them over here!
8-
Edit this file, and the bot will squash your changes :)
9-
10-
The bot does some handling of markdown. Please file a bug if it does the wrong
11-
thing! https://github.com/PolymerLabs/tedium/issues
12-
13-
-->
14-
15-
_[Demo and API Docs](https://elements.polymer-project.org/elements/iron-scroll-threshold)_
16-
17-
18-
##&lt;undefined&gt;
19-
20-
Fired when `lowerTriggered` becomes `true`.
21-
22-
1+
iron-scroll-threshold
2+
=========
3+
4+
`iron-scroll-threshold` is a utility element that listens for `scroll` events from a
5+
scrollable region and fires events to indicate when the scroller has reached a pre-defined
6+
limit, specified in pixels from the upper and lower bounds of the scrollable region.
7+
This element may wrap a scrollable region and will listen for `scroll` events bubbling
8+
through it from its children. In this case, care should be taken that only one scrollable
9+
region with the same orientation as this element is contained within. Alternatively,
10+
the `scrollTarget` property can be set/bound to a non-child scrollable region, from which
11+
it will listen for events.
12+
13+
Once a threshold has been reached, a `lower-threshold` or `upper-threshold` event will
14+
be fired, at which point the user may perform actions such as lazily-loading more data
15+
to be displayed. After any work is done, the user must then clear the threshold by
16+
calling the `clearTriggers` method on this element, after which it will
17+
begin listening again for the scroll position to reach the threshold again assuming
18+
the content in the scrollable region has grown. If the user no longer wishes to receive
19+
events (e.g. all data has been exhausted), the threshold property in question (e.g.
20+
`lowerThreshold`) may be set to a falsy value to disable events and clear the associated
21+
triggered property.
22+
23+
### Example
24+
25+
```html
26+
<iron-scroll-threshold on-lower-threshold="loadMoreData">
27+
<div>content</div>
28+
</iron-scroll-threshold>
29+
```
30+
31+
```js
32+
loadMoreData: function() {
33+
// load async stuff. e.g. XHR
34+
asyncStuff(function done() {
35+
ironScrollTheshold.clearTriggers();
36+
});
37+
}
38+
```
39+
40+
### Using dom-repeat
41+
42+
```html
43+
<iron-scroll-threshold on-lower-threshold="loadMoreData">
44+
<dom-repeat items="[[items]]">
45+
<template>
46+
<div>[[index]]</div>
47+
</template>
48+
</dom-repeat>
49+
</iron-scroll-threshold>
50+
```
51+
52+
### Using iron-list
53+
54+
```html
55+
<iron-scroll-threshold on-lower-threshold="loadMoreData" id="threshold">
56+
<iron-list scroll-target="threshold" items="[[items]]">
57+
<template>
58+
<div>[[index]]</div>
59+
</template>
60+
</iron-list>
61+
</iron-scroll-threshold>
62+
```

bower.json

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
{
2-
"name": "core-scroll-threshold",
3-
"private": true,
4-
"dependencies": {},
5-
"ignore": []
2+
"name": "iron-scroll-threshold",
3+
"description": "Triggers an event when nearing the beginning or end of a scrollable element ",
4+
"keywords": [
5+
"web-components",
6+
"polymer"
7+
],
8+
"version": "1.0.0",
9+
"homepage": "https://github.com/PolymerElements/iron-scroll-threshold",
10+
"authors": [
11+
"The Polymer Authors"
12+
],
13+
"repository": {
14+
"type": "git",
15+
"url": "git://github.com/PolymerElements/iron-scroll-threshold"
16+
},
17+
"main": "iron-scroll-threshold.html",
18+
"license": "http://polymer.github.io/LICENSE.txt",
19+
"ignore": [],
20+
"dependencies": {
21+
"polymer": "Polymer/polymer#^1.1.0",
22+
"iron-scroll-target-behavior": "PolymerElements/iron-scroll-target-behavior#^1.0.0"
23+
},
24+
"devDependencies": {
25+
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
26+
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.2",
27+
"web-component-tester": "polymer/web-component-tester#^3.4.0"
28+
}
629
}

core-scroll-threshold.html

Lines changed: 0 additions & 257 deletions
This file was deleted.

0 commit comments

Comments
 (0)