feat(main): Add base theme: This is the falcon theme out of the box.
This is falcon v3.1.2
This commit is contained in:
30
_dev/js/theme/components/TopMenu.js
Normal file
30
_dev/js/theme/components/TopMenu.js
Normal file
@ -0,0 +1,30 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
export default class TopMenu {
|
||||
constructor(el) {
|
||||
this.$el = $(el);
|
||||
}
|
||||
|
||||
init() {
|
||||
const self = this;
|
||||
self.$el.hoverIntent({
|
||||
over: self.toggleClassSubMenu,
|
||||
out: self.toggleClassSubMenu,
|
||||
selector: ' > li',
|
||||
timeout: 300,
|
||||
});
|
||||
}
|
||||
|
||||
toggleClassSubMenu() {
|
||||
const $item = $(this);
|
||||
let expanded = $item.attr('aria-expanded');
|
||||
|
||||
if (typeof expanded !== 'undefined') {
|
||||
expanded = expanded.toLowerCase() === 'true';
|
||||
$item.toggleClass('main-menu__item--active').attr('aria-expanded', !expanded);
|
||||
$('.main-menu__sub', $item)
|
||||
.attr('aria-expanded', !expanded)
|
||||
.attr('aria-hidden', expanded);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user