OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Behavior for scrollable containers with <iron-list>. | 6 * @fileoverview Behavior for scrollable containers with <iron-list>. |
7 * | 7 * |
8 * Any containers with the 'scrollable' attribute set will have the following | 8 * Any containers with the 'scrollable' attribute set will have the following |
9 * classes toggled appropriately: can-scroll, is-scrolled, scrolled-to-bottom. | 9 * classes toggled appropriately: can-scroll, is-scrolled, scrolled-to-bottom. |
10 * These classes are used to style the container div and list elements | 10 * These classes are used to style the container div and list elements |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 /** | 106 /** |
107 * This gets called once intially and any time a scrollable container scrolls. | 107 * This gets called once intially and any time a scrollable container scrolls. |
108 * @param {!HTMLElement} scrollable | 108 * @param {!HTMLElement} scrollable |
109 * @private | 109 * @private |
110 */ | 110 */ |
111 updateScroll_: function(scrollable) { | 111 updateScroll_: function(scrollable) { |
112 scrollable.classList.toggle( | 112 scrollable.classList.toggle( |
113 'can-scroll', scrollable.clientHeight < scrollable.scrollHeight); | 113 'can-scroll', scrollable.clientHeight < scrollable.scrollHeight); |
114 scrollable.classList.toggle('is-scrolled', scrollable.scrollTop > 0); | 114 scrollable.classList.toggle('is-scrolled', scrollable.scrollTop > 0); |
115 scrollable.classList.toggle( | 115 scrollable.classList.toggle( |
116 'scrolled-to-bottom', scrollable.scrollTop + scrollable.clientHeight >= | 116 'scrolled-to-bottom', |
| 117 scrollable.scrollTop + scrollable.clientHeight >= |
117 scrollable.scrollHeight); | 118 scrollable.scrollHeight); |
118 }, | 119 }, |
119 }; | 120 }; |
OLD | NEW |