Commit a0df465d authored by Rafael Weinstein's avatar Rafael Weinstein

Add auto-scroll option to sky city-list example

TBR=esprehn

Review URL: https://codereview.chromium.org/758753003
parent 7da267c4
...@@ -599,6 +599,11 @@ SkyElement({ ...@@ -599,6 +599,11 @@ SkyElement({
return; return;
this.updateView(this.loader.getItems(), true); this.updateView(this.loader.getItems(), true);
},
scrollBy: function(amount) {
this.scrollerElement.scrollTop += amount;
this.handleScroll({ target: this.scrollerElement });
} }
}); });
......
...@@ -29,5 +29,21 @@ window.startLoad = new Date().getTime(); ...@@ -29,5 +29,21 @@ window.startLoad = new Date().getTime();
</script> </script>
<body> <body>
<city-list></city-list> <city-list></city-list>
<script>
var cityList = document.querySelector('city-list');
var scrollBy = location.search.match(/auto=([0-9]+)/)[1];
function autoScroll() {
cityList.scrollBy(scrollBy);
requestAnimationFrame(autoScroll);
}
if (scrollBy) {
console.log('Autoscroll by ' + scrollBy);
setTimeout(function() {
requestAnimationFrame(autoScroll);
}, 200)
}
</script>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment