Skip to content

Commit

Permalink
Accordion Example: Fix IE incompatibility (pull #466)
Browse files Browse the repository at this point in the history
Per feedback in issue #401, make js compatible with IE 11.
mcking65 authored Oct 11, 2017

Verified

This commit was signed with the committer’s verified signature. The key has been revoked.
richardcase Richard Case
2 parents f9c986a + 94796a9 commit a6d74df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/accordion/js/accordion.js
Original file line number Diff line number Diff line change
@@ -3,16 +3,18 @@ Simple accordion pattern example
Gerard K. Cohen, 05/20/2017
*/

Array.from(document.querySelectorAll('.Accordion')).forEach(function (accordion) {
'use strict';

Array.prototype.slice.call(document.querySelectorAll('.Accordion')).forEach(function (accordion) {

// Allow for multiple accordion sections to be expanded at the same time
var allowMultiple = accordion.hasAttribute('data-allow-multiple');
// Allow for each toggle to both open and close individually
var allowToggle = (allowMultiple) ? allowMultiple : accordion.hasAttribute('data-allow-toggle');

// Create the array of toggle elements for the accordion group
var triggers = Array.from(accordion.querySelectorAll('.Accordion-trigger'));
var panels = Array.from(accordion.querySelectorAll('.Accordion-panel'));
var triggers = Array.prototype.slice.call(accordion.querySelectorAll('.Accordion-trigger'));
var panels = Array.prototype.slice.call(accordion.querySelectorAll('.Accordion-panel'));

accordion.addEventListener('click', function (event) {
var target = event.target;

0 comments on commit a6d74df

Please sign in to comment.