mirror of
https://github.com/picocss/pico.git
synced 2025-04-20 16:46:14 -04:00
Refactor: JS syntax
This commit is contained in:
parent
5557876fce
commit
0c64ec721a
6 changed files with 129 additions and 211 deletions
|
@ -18,25 +18,14 @@ export const toggleNavigation = {
|
|||
},
|
||||
|
||||
onToggleClick() {
|
||||
this.toggleLink.addEventListener(
|
||||
'click',
|
||||
function (event) {
|
||||
event.preventDefault();
|
||||
if (this.state == 'closed-on-mobile') {
|
||||
this.state = 'open';
|
||||
} else {
|
||||
this.state = 'closed-on-mobile';
|
||||
}
|
||||
this.nav.removeAttribute('class');
|
||||
this.nav.classList.add(this.state);
|
||||
}.bind(this),
|
||||
false
|
||||
);
|
||||
},
|
||||
|
||||
// Apply navigation state
|
||||
applyState() {
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue