Here is what I did but still nothing!
When your mouse entered the sag menu is opened && closed when your mouse left. I tried but nothing happened…
Any ideas? Thanks.
import S from 'skylake'
class HomeSticky {
constructor() {
S.BindMaker(this, ["menuOpen", "menuClose"])
}
init () {
this.first = !1
this.listeners("add")
}
listeners (opts) {
S.Listen("#nav-link-submenu", opts, "mouseenter", this.menuOpen)
S.Listen("#nav-link-submenu", opts, "mouseleave", this.menuClose)
}
menuOpen () {
this.first = !0
this.isOver = !0
S.Geb.id("nav-container").className = "active"
this.isOver && !this.isAnimated && this.open()
}
menuClose () {
this.first && (this.isOver = !1, S.Geb.id("nav-container").className = "", this.isOver || this.isAnimated || this.close())
}
open () {
function myCallback () {
const morph2Animation = new S.Morph({
type: 'path',
element: '#nav-morph-path',
start: 'M 10,0 L 10,0 C 10,0 10,0 5,0 C 0,0 0,0 0,0 L 0,0 Z',
end: 'M 0,0 L 10,0 L 10,10 C 10,10 10,10 5,10 C 0,10 0,10 0,10 Z',
duration: 600,
ease: 'ExpoOut',
delay: 700,
callback: (t) => {
this.isAnimated = !1,
this.isOver || this.close()
}
})
morph2Animation.play()
}
_ => this
this.isAnimated = !0
S.Geb.id('nav-wrap').className = 'active'
S.Geb.id('nav-morph-path').setAttribute('d', 'M 0,0 L 10,0 L 10,0 C 10,0 10,0 5,0 C 0,0 0,0 0,0 Z')
const morph1Animation = new S.Morph({
type: 'path',
element: '#nav-morph-path',
start: 'M 10,0 L 10,10 C 10,10 10,5 5,5 C 0,5 0,10 0,10 L 0,0 Z',
end: 'M 10,0 L 10,0 C 10,0 10,0 5,0 C 0,0 0,0 0,0 L 0,0 Z',
duration: 600,
ease: 'ExpoOut',
delay: 700,
callbackDelay: myCallback,
callback: myCallback
})
const tl = new S.Timeline()
tl.from('#nav-submenu-extend-bottom', '3dy', -200, 0)
tl.from('#nav-submenu-extend-left', '3dy', -200, 0)
tl.from('.nav-submenu-link-title', '3dy', -100, 0, 500, 'Power4Out', {delay: 400})
tl.from('.nav-submenu-link-no', 'opacity', -100, 0, 500, 'Power4Out', {Delay: 50})
tl.play()
morph1Animation.play()
console.log(morph1Animation)
}
close () {
function myCallback () {
const morph4Animation = new S.Morph({
type: 'path',
element: '#nav-morph-path',
end: 'M 10,0 L 10,0 C 10,0 10,0 5,0 C 0,0 0,0 0,0 L 0,0 Z',
duration: 600,
ease: 'ExpoOut',
delay: 700,
callback: (t) => {
this.isAnimated = !1,
this.isOver || this.open()
}
})
morph4Animation.play()
}
_ => this
this.isAnimated = !0
const navWrap = S.Geb.id("nav-wrap").className = ""
const navMorphPath = S.Geb.id("nav-morph-path").setAttribute("d", "M 10,0 L 10,10 C 10,10 10,10 5,10 C 0,10 0,10 0,10 L 0,0 Z")
const morph3Animation = new S.Morph({
type: 'path',
element: '#nav-morph-path',
end: 'M 10,0 L 10,10 C 10,10 10,5 5,5 C 0,5 0,10 0,10 L 0,0 Z',
duration: 300,
ease: 'Power3In',
delay: 700,
callbackDelay: myCallback,
callback: myCallback
})
const tl = new S.Timeline()
tl.from("#nav-submenu-extend-left", "3dy", 0, -200)
tl.from(".nav-submenu-link-title", "3dy", 0, -100, 160, "Power2In")
tl.from(".nav-submenu-link-no", "3dy", 0, -100, 160, "Power2In")
tl.from("#nav-submenu-extend-bottom", "3dy", 0, -200, { delay: 160 })
tl.play()
morph3Animation.play()
}
destroy (opts) {
this.listeners("remove"),
this.morph1Animation && this.morph1Animation.pause()
this.morph2Animation && this.morph2Animation.pause()
this.morph3Animation && this.morph3Animation.pause()
this.morph4Animation && this.morph4Animation.pause()
}
}
export default HomeSticky