OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polym
er.github.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CO
NTRIBUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/P
ATENTS.txt |
| 9 --> |
| 10 <!doctype html> |
| 11 <html> |
| 12 <head> |
| 13 |
| 14 <title>core-image</title> |
| 15 |
| 16 <script src="../webcomponentsjs/webcomonents.js"></script> |
| 17 |
| 18 <link rel="import" href="core-scroll-threshold.html"> |
| 19 |
| 20 <style> |
| 21 #scroller { |
| 22 height: 300px; |
| 23 border: 1px solid red; |
| 24 padding: 20px; |
| 25 overflow: auto; |
| 26 } |
| 27 .thing { |
| 28 padding: 10px; |
| 29 margin: 10px; |
| 30 background: lightblue; |
| 31 border-radius: 10px; |
| 32 font-size: 2em; |
| 33 } |
| 34 </style> |
| 35 |
| 36 </head> |
| 37 <body unresolved> |
| 38 |
| 39 <template is="auto-binding"> |
| 40 <core-scroll-threshold id="threshold" scrollTarget="{{$.scroller}}" lowerThres
hold="100" on-lower-trigger="{{loadMore}}" fit></core-scroll-threshold> |
| 41 <div id="scroller" fit> |
| 42 <template repeat="{{i in data}}"> |
| 43 <div class="thing">{{i}}</div> |
| 44 </template> |
| 45 <div hidden?="{{!$.threshold.lowerTriggered}}">Please wait...</div> |
| 46 </div> |
| 47 </template> |
| 48 |
| 49 <script> |
| 50 |
| 51 addEventListener('template-bound', function(e) { |
| 52 |
| 53 var scope = e.target; |
| 54 var n; |
| 55 scope.data = []; |
| 56 for (n=0; n<20; n++) { |
| 57 scope.data.push(n); |
| 58 } |
| 59 scope.loadMore = function() { |
| 60 setTimeout(function() { |
| 61 for (var i=n; i<n+10; i++) { |
| 62 scope.data.push(i); |
| 63 } |
| 64 n = i; |
| 65 scope.$.threshold.clearLower(); |
| 66 }, 1000); |
| 67 }; |
| 68 }); |
| 69 |
| 70 </script> |
| 71 |
| 72 </body> |
| 73 </html> |
OLD | NEW |