Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: sky/examples/city-list/index.sky

Issue 758753003: Add auto-scroll option to sky city-list example (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: ws Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/city-list/city-list.sky ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/city-list/index.sky
diff --git a/sky/examples/city-list/index.sky b/sky/examples/city-list/index.sky
index 26e51444f6de0e5d7b54a894b0f06804fdef4a36..45cfe145ee446c5e0bf91538133b305f8d00e3c8 100644
--- a/sky/examples/city-list/index.sky
+++ b/sky/examples/city-list/index.sky
@@ -29,5 +29,21 @@ window.startLoad = new Date().getTime();
</script>
<body>
<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>
</html>
« no previous file with comments | « sky/examples/city-list/city-list.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698