mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Merge pull request #3218 from Human-Connection/2607-fix-layout-shift
fix: layout shift [2607]
This commit is contained in:
commit
d18e14a9be
@ -48,11 +48,23 @@ export default {
|
||||
if (isOpen) {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
document.getElementsByTagName('body')[0].classList.add('dropdown-open')
|
||||
const paddingRightStyle = `${window.innerWidth -
|
||||
document.documentElement.clientWidth}px`
|
||||
const navigationElement = document.querySelector('.main-navigation')
|
||||
document.body.style.paddingRight = paddingRightStyle
|
||||
document.body.classList.add('dropdown-open')
|
||||
if (navigationElement) {
|
||||
navigationElement.style.paddingRight = paddingRightStyle
|
||||
}
|
||||
}, 20)
|
||||
})
|
||||
} else {
|
||||
document.getElementsByTagName('body')[0].classList.remove('dropdown-open')
|
||||
const navigationElement = document.querySelector('.main-navigation')
|
||||
document.body.style.paddingRight = null
|
||||
document.body.classList.remove('dropdown-open')
|
||||
if (navigationElement) {
|
||||
navigationElement.style.paddingRight = null
|
||||
}
|
||||
}
|
||||
} catch (err) {}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user