mirror of
https://github.com/picocss/pico.git
synced 2025-04-20 16:46:14 -04:00
Revert "Merge branch 'master' into dev"
This reverts commit6a6d67dbab
, reversing changes made toba4bd765d8
.
This commit is contained in:
parent
6a6d67dbab
commit
41314ab4b0
83 changed files with 2367 additions and 1839 deletions
42
docs/js/src/toggle-navigation.js
Normal file
42
docs/js/src/toggle-navigation.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Toggle navigation
|
||||
*
|
||||
* Pico.css - https://picocss.com
|
||||
* Copyright 2019-2021 - Licensed under MIT
|
||||
*/
|
||||
|
||||
export const toggleNavigation = {
|
||||
|
||||
// Config
|
||||
_state: 'closed-on-mobile',
|
||||
toggleLink: document.getElementById('toggle-docs-navigation'),
|
||||
nav: document.querySelector('main > aside > nav'),
|
||||
|
||||
// Init
|
||||
init() {
|
||||
this.onToggleClick()
|
||||
},
|
||||
|
||||
onToggleClick() {
|
||||
this.toggleLink.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
this.state == 'closed-on-mobile'
|
||||
? this.state = 'open'
|
||||
: this.state = 'closed-on-mobile';
|
||||
this.nav.removeAttribute('class');
|
||||
this.nav.classList.add(this.state);
|
||||
}, false);
|
||||
},
|
||||
|
||||
// Get state
|
||||
get state() {
|
||||
return this._state;
|
||||
},
|
||||
|
||||
// Set state
|
||||
set state(state) {
|
||||
this._state = state;
|
||||
},
|
||||
};
|
||||
|
||||
export default toggleNavigation;
|
Loading…
Add table
Add a link
Reference in a new issue