mirror of
https://github.com/picocss/pico.git
synced 2025-04-20 08:45:06 -04:00
30 lines
632 B
JavaScript
30 lines
632 B
JavaScript
/*
|
|
* Aside adjustment
|
|
*
|
|
* Pico.css - https://picocss.com
|
|
* Copyright 2019-2021 - Licensed under MIT
|
|
*/
|
|
|
|
export const aside = {
|
|
|
|
// Config
|
|
_minWidth: '992px',
|
|
_targets: {
|
|
nav: 'aside nav',
|
|
details: 'aside details',
|
|
},
|
|
|
|
|
|
// Init
|
|
init() {
|
|
if (window.matchMedia('(min-width: ' + this._minWidth + ')').matches) {
|
|
let nav = document.querySelector(this._targets.nav);
|
|
let details = document.querySelectorAll(this._targets.details);
|
|
if (nav.clientHeight < nav.scrollHeight) {
|
|
details.forEach(function(detail) {
|
|
detail.removeAttribute("open");
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|