Changed the menu click point to the arrow
This commit is contained in:
parent
3f130712b4
commit
5bc71cc7f6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -107,15 +107,16 @@ if (hljs) {
|
|||
};
|
||||
};
|
||||
|
||||
var navItems = document.querySelectorAll('.Nav__item.has-children > a');
|
||||
var navItems = document.querySelectorAll('.Nav__item.has-children i.Nav__arrow');
|
||||
|
||||
function _toggleSubMenu(ev) {
|
||||
if (ev.preventDefault !== undefined) {
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
var parent = ev.target.parentNode;
|
||||
var parent = ev.target.parentNode.parentNode;
|
||||
var subNav = parent.querySelector('ul.Nav');
|
||||
console.log(parent);
|
||||
|
||||
if (ev.preventDefault !== undefined && parent.classList.contains('Nav__item--open')) {
|
||||
subNav.style.height = 0;
|
||||
|
@ -156,7 +157,7 @@ if (hljs) {
|
|||
cur = navItems[i];
|
||||
cur.addEventListener('click', _toggleSubMenu);
|
||||
|
||||
if (cur.parentNode.classList.contains('Nav__item--open')) {
|
||||
if (cur.parentNode.parentNode.classList.contains('Nav__item--open')) {
|
||||
_toggleSubMenu({ target: cur });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,11 +159,6 @@ Components
|
|||
width: 16px;
|
||||
margin-left: -16px;
|
||||
|
||||
// Prevent arrow from being the target in its container's event listener.
|
||||
&, &::before {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
display: block;
|
||||
|
|
Loading…
Reference in New Issue