jellyfin-web/dashboard-ui/bower_components/iron-scroll-threshold/demo/document.html

104 lines
2.6 KiB
HTML
Raw Normal View History

2016-04-21 11:00:32 -07:00
<!doctype html>
<!--
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html id="html">
<head>
<title>iron-scroll-threshold using the document scroll</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-scroll-threshold.html">
<link rel="import" href="sample-content.html">
<style>
body {
margin: 0;
padding: 0;
}
.toolbar {
background-color: #3367d6;
z-index: 1;
font: 15px arial;
height: 54px;
line-height: 54px;
padding-left: 20px;
padding-right: 20px;
color: white;
position: fixed;
top: 0;
left: 0;
right: 0;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}
.loader {
background-color: #0b8043;
text-align: center;
height: 44px;
font: 13px arial;
line-height: 44px;
color: white;
}
sample-content {
padding-top: 54px;
}
iron-scroll-threshold {
display: none;
}
</style>
</head>
<body unresolved>
<template is="dom-bind" id="overlay" size="5">
<div class="toolbar">
<b>Document Scroll</b> |
Upper: [[upperTriggered]] - Lower: [[lowerTriggered]]
</div>
<sample-content size="[[size]]"></sample-content>
<div class="loader">Fetching new items...</div>
<!-- scroll-target uses the document scroll -->
<iron-scroll-threshold id="scrollThreshold"
scroll-target="html"
lower-threshold="500"
lower-triggered="{{lowerTriggered}}"
on-lower-threshold="loadMoreData">
</iron-scroll-threshold>
</template>
<script>
(function(scope) {
scope.loadMoreData = function() {
// Simulate network delay
setTimeout(function() {
scope.size = +scope.size + 5;
scope.$.scrollThreshold.clearTriggers();
}, 500);
};
})(document.querySelector('#overlay'));
</script>
</body>
</html>