Index: chrome/browser/resources/welcome/win10/toggle-section.js |
diff --git a/chrome/browser/resources/welcome/win10/toggle-section.js b/chrome/browser/resources/welcome/win10/toggle-section.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ef82e1e93f278d9ad1a7decaae7e0952b844c7dc |
--- /dev/null |
+++ b/chrome/browser/resources/welcome/win10/toggle-section.js |
@@ -0,0 +1,29 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+cr.define('togglesection', function() { |
+ 'use strict'; |
+ |
+ function toggleSections(sections) { |
+ sections.forEach(function(section) { |
+ section.classList.toggle('section--expanded'); |
+ }); |
+ } |
+ |
+ function initialize() { |
+ var sections = document.querySelectorAll('.section'); |
+ sections.forEach(function(section) { |
+ var sectionHeading = section.querySelector('.section-heading'); |
+ sectionHeading.addEventListener('click', function() { |
+ toggleSections(sections); |
+ }); |
+ }); |
+ } |
+ |
+ return { |
+ initialize: initialize |
+ }; |
+}); |
+ |
+document.addEventListener('DOMContentLoaded', togglesection.initialize); |