You've already forked Ghost-Theme-Source
Dynamic dropdown menu placement based on the toggle location
This commit is contained in:
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
@@ -717,9 +717,9 @@ Search LOGO Login Subscribe
|
||||
transform: translate3d(0, 6px, 0);
|
||||
}
|
||||
|
||||
.is-middle-logo .gh-dropdown {
|
||||
.gh-dropdown.is-left {
|
||||
right: auto;
|
||||
left: -24px;
|
||||
left: -16px;
|
||||
}
|
||||
|
||||
.is-dropdown-mega .gh-dropdown {
|
||||
|
||||
@@ -56,6 +56,13 @@ function dropdown() {
|
||||
toggle.appendChild(wrapper);
|
||||
nav.appendChild(toggle);
|
||||
|
||||
const toggleRect = toggle.getBoundingClientRect();
|
||||
const documentCenter = window.innerWidth / 2;
|
||||
|
||||
if (toggleRect.left < documentCenter) {
|
||||
wrapper.classList.add('is-left');
|
||||
}
|
||||
|
||||
head.classList.add('is-dropdown-loaded');
|
||||
|
||||
window.addEventListener('click', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user