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

Side by Side Diff: sky/examples/city-list/index.sky

Issue 759483003: Fix bug in city-list autoscroll (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <!DOCTYPE html> 6 <!DOCTYPE html>
7 <html> 7 <html>
8 <head> 8 <head>
9 <meta charset="utf-8"> 9 <meta charset="utf-8">
10 <meta name="viewport" 10 <meta name="viewport"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 </style> 25 </style>
26 </head> 26 </head>
27 <script> 27 <script>
28 window.startLoad = new Date().getTime(); 28 window.startLoad = new Date().getTime();
29 </script> 29 </script>
30 <body> 30 <body>
31 <city-list></city-list> 31 <city-list></city-list>
32 <script> 32 <script>
33 var cityList = document.querySelector('city-list'); 33 var cityList = document.querySelector('city-list');
34 var scrollBy = location.search.match(/auto=([0-9]+)/)[1]; 34 var scrollBy = Number(location.search.match(/auto=([0-9]+)/)[1]);
esprehn 2014/11/25 07:50:21 match returns null if it doesn't match anything, t
rafaelw 2014/11/28 04:22:48 Woops. Good catch. Fixed: https://codereview.chrom
35 35
36 function autoScroll() { 36 function autoScroll() {
37 cityList.scrollBy(scrollBy); 37 cityList.scrollBy(scrollBy);
38 requestAnimationFrame(autoScroll); 38 requestAnimationFrame(autoScroll);
39 } 39 }
40 40
41 if (scrollBy) { 41 if (scrollBy) {
42 console.log('Autoscroll by ' + scrollBy);
43 setTimeout(function() { 42 setTimeout(function() {
44 requestAnimationFrame(autoScroll); 43 requestAnimationFrame(autoScroll);
45 }, 200) 44 }, 200)
46 } 45 }
47 </script> 46 </script>
48 </body> 47 </body>
49 </html> 48 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698