mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 11:42:39 +00:00
⚡ Perf: optimize sub menu position calculation in desktop header with css replace of javascript
This commit is contained in:
@@ -115,11 +115,7 @@ class FixIt {
|
||||
}
|
||||
|
||||
initMenuDesktop() {
|
||||
// This is a dirty hack for fixing sub menu position error in desktop header
|
||||
this.util.forEach(document.querySelectorAll('.has-children, #header-desktop .language'), ($item) => {
|
||||
$item.addEventListener('mouseover', function () {
|
||||
this.querySelector('.sub-menu').style.left = `${this.getBoundingClientRect().left}px`;
|
||||
});
|
||||
$item.querySelector('.sub-menu').style.minWidth = `${$item.offsetWidth - 8}px`;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user