comparison core/themes/seven/js/responsive-details.js @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
11 var $details = $(context).find('details').once('responsive-details'); 11 var $details = $(context).find('details').once('responsive-details');
12 12
13 if (!$details.length) { 13 if (!$details.length) {
14 return; 14 return;
15 } 15 }
16
17 var $summaries = $details.find('> summary');
16 18
17 function detailsToggle(matches) { 19 function detailsToggle(matches) {
18 if (matches) { 20 if (matches) {
19 $details.attr('open', true); 21 $details.attr('open', true);
20 $summaries.attr('aria-expanded', true); 22 $summaries.attr('aria-expanded', true);
29 31
30 function handleDetailsMQ(event) { 32 function handleDetailsMQ(event) {
31 detailsToggle(event.matches); 33 detailsToggle(event.matches);
32 } 34 }
33 35
34 var $summaries = $details.find('> summary');
35 var mql = window.matchMedia('(min-width:48em)'); 36 var mql = window.matchMedia('(min-width:48em)');
36 mql.addListener(handleDetailsMQ); 37 mql.addListener(handleDetailsMQ);
37 detailsToggle(mql.matches); 38 detailsToggle(mql.matches);
38 } 39 }
39 }; 40 };