Blocked scroll when mobile menu is open

pull/358/head
cagataycivici 2020-07-03 09:51:54 +03:00
parent 0bc8ab32d5
commit 68fc69b99b
3 changed files with 36 additions and 49 deletions

View File

@ -26,6 +26,7 @@
</template> </template>
<script> <script>
import DomHandler from '@/components/utils/DomHandler';
import AppTopBar from '@/AppTopBar.vue'; import AppTopBar from '@/AppTopBar.vue';
import AppMenu from '@/AppMenu.vue'; import AppMenu from '@/AppMenu.vue';
import AppFooter from '@/AppFooter.vue'; import AppFooter from '@/AppFooter.vue';
@ -40,7 +41,6 @@ export default {
theme: 'saga-blue' theme: 'saga-blue'
} }
}, },
mounted() { mounted() {
if (this.isOutdatedIE()) { if (this.isOutdatedIE()) {
this.$toast.add({severity: 'warn', summary: 'Limited Functionality', detail: 'Although PrimeVue supports IE11, ThemeSwitcher in this application cannot be not fully supported by your browser. Please use a modern browser for the best experience of the showcase.'}); this.$toast.add({severity: 'warn', summary: 'Limited Functionality', detail: 'Although PrimeVue supports IE11, ThemeSwitcher in this application cannot be not fully supported by your browser. Please use a modern browser for the best experience of the showcase.'});
@ -58,16 +58,25 @@ export default {
} }
this.sidebarActive = false; this.sidebarActive = false;
DomHandler.removeClass(document.body, 'blocked-scroll');
this.$toast.removeAllGroups(); this.$toast.removeAllGroups();
} }
} }
}, },
methods: { methods: {
onMenuButtonClick() { onMenuButtonClick() {
this.sidebarActive = !this.sidebarActive; if (this.sidebarActive) {
this.sidebarActive = false;
DomHandler.removeClass(document.body, 'blocked-scroll');
}
else {
this.sidebarActive = true;
DomHandler.addClass(document.body, 'blocked-scroll');
}
}, },
onMaskClick() { onMaskClick() {
this.sidebarActive = false; this.sidebarActive = false;
DomHandler.removeClass(document.body, 'blocked-scroll');
}, },
hideNews() { hideNews() {
this.newsActive = false; this.newsActive = false;

View File

@ -1,15 +1,3 @@
@keyframes pulse {
0% {
background-color: rgba(165, 165, 165, 0.1)
}
50% {
background-color: rgba(165, 165, 165, 0.3)
}
100% {
background-color: rgba(165, 165, 165, 0.1)
}
}
$linkColor: #2196f3; $linkColor: #2196f3;
$focusBorderColor:#BBDEFB; $focusBorderColor:#BBDEFB;
@ -44,21 +32,6 @@ a {
text-decoration: none; text-decoration: none;
} }
.layout-mask {
background-color: rgba(0, 0, 0, 0.1);
}
.layout-mask-active {
z-index: 998;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.4);
transition: background-color .5s;
}
.clearfix { .clearfix {
display: inline-block; display: inline-block;
@ -79,28 +52,15 @@ a {
display: block; display: block;
} }
/* Animation */ @keyframes pulse {
@-webkit-keyframes fadeInDown { 0% {
from { background-color: rgba(165, 165, 165, 0.1)
opacity: 0;
transform: translate3d(0, -20px, 0);
} }
50% {
to { background-color: rgba(165, 165, 165, 0.3)
opacity: 1;
transform: none;
} }
} 100% {
background-color: rgba(165, 165, 165, 0.1)
@keyframes fadeInDown {
from {
opacity: 0;
transform: translate3d(0, -20px, 0);
}
to {
opacity: 1;
transform: none;
} }
} }

View File

@ -90,7 +90,21 @@
} }
} }
} }
}
.layout-mask {
background-color: rgba(0, 0, 0, 0.1);
}
.layout-mask-active {
z-index: 998;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.4);
transition: background-color .5s;
} }
.home { .home {
@ -129,6 +143,10 @@
transform: translate3d(0,0,0); transform: translate3d(0,0,0);
} }
} }
.blocked-scroll {
overflow: hidden;
}
} }
@media screen and (max-width: 640px) { @media screen and (max-width: 640px) {