mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 03:32:40 +00:00
⚡ Perf: optimize sub menu position calculation in desktop header with css replace of javascript
This commit is contained in:
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
||||
- :sparkles: Feat: add params to close wordcount and readingTime in post ([#209](https://github.com/hugo-fixit/FixIt/issues/209))
|
||||
- :truck: Feat: migrate parameter `params.autoBookmark` to `params.page.autoBookmark` ([#55](https://github.com/hugo-fixit/FixIt/issues/55))
|
||||
- :zap: Perf: optimize close comment feature when the post has expired ([#204](https://github.com/hugo-fixit/FixIt/issues/204))
|
||||
- :zap: Perf: optimize sub menu position calculation in desktop header with css replace of javascript
|
||||
- :bug: Fix: remove the leading and trailing whitespace of the code string ([#205](https://github.com/hugo-fixit/FixIt/issues/205))
|
||||
- :bento: Fix: update webfonts for fontawesome 6.2.0 (@NicoDreamzZ[#228](https://github.com/hugo-fixit/FixIt/pull/228))
|
||||
- :bug: Fix: image shortcode/plugin lose the support for svg type files ([#210](https://github.com/hugo-fixit/FixIt/issues/210))
|
||||
|
||||
@@ -219,6 +219,7 @@ header {
|
||||
>.menu-item:hover {
|
||||
& .sub-menu {
|
||||
display: block;
|
||||
transform: translateX(-0.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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