Merge pull request #7197 from guidoDutra/5916-fix-content-moves-when-cart-open

fix content moving when cart is open
This commit is contained in:
Andy Brett
2021-04-01 07:23:32 -07:00
committed by GitHub
2 changed files with 11 additions and 7 deletions

View File

@@ -3,7 +3,15 @@ Darkswarm.directive "bodyScroll", ($rootScope, BodyScroll) ->
scope: true
link: (scope, elem, attrs) ->
$rootScope.$on "toggleBodyScroll", ->
if BodyScroll.disabled
elem.addClass "disable-scroll"
if BodyScroll.disabled && document.body.scrollHeight > document.body.clientHeight
document.body.style.top = "-#{window.scrollY}px"
document.body.style.position = 'fixed'
document.body.style.overflowY = 'scroll'
document.body.style.width = '100%'
else
elem.removeClass "disable-scroll"
scrollY = parseInt(document.body.style.top) * -1
document.body.style.position = ''
document.body.style.top = ''
document.body.style.overflowY = ''
document.body.style.width = ''
window.scrollTo(0, scrollY) if scrollY

View File

@@ -165,7 +165,3 @@ a.button.large {
.flex {
display: flex;
}
.disable-scroll {
overflow: hidden;
}