DRAFT | new theme - minimage
This commit is contained in:
parent
5116fe4640
commit
ac8d9e7eb3
90 changed files with 15302 additions and 1 deletions
32
themes/minimage/source/javascript/GlobalNav.js
Normal file
32
themes/minimage/source/javascript/GlobalNav.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
class GlobalNav {
|
||||
constructor () {
|
||||
this.opener = document.querySelectorAll('.c-menu')
|
||||
this.closer = document.querySelectorAll('.c-global-nav__closer')
|
||||
this.overlay = document.querySelectorAll('.c-overlay')
|
||||
this.isOpen = false
|
||||
|
||||
Array.from(this.opener, (opener) => {
|
||||
opener.addEventListener('click', this.overlaySwitcher.bind(this), false)
|
||||
})
|
||||
|
||||
Array.from(this.closer, (closer) => {
|
||||
closer.addEventListener('click', this.overlaySwitcher.bind(this), false)
|
||||
})
|
||||
}
|
||||
|
||||
overlaySwitcher () {
|
||||
if (this.isOpen) {
|
||||
this.overlay.forEach((overlay) => {
|
||||
this.isOpen = false
|
||||
overlay.classList.remove('isShow')
|
||||
})
|
||||
} else {
|
||||
this.overlay.forEach((overlay) => {
|
||||
this.isOpen = true
|
||||
overlay.classList.add('isShow')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default GlobalNav
|
||||
5
themes/minimage/source/javascript/application.js
Normal file
5
themes/minimage/source/javascript/application.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import GlobalNav from './GlobalNav'
|
||||
|
||||
window.onload = () => {
|
||||
new GlobalNav()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue