forked from rDrama/rDrama
1
0
Fork 0

better solution to the modal scrollbar question

master
Aevann 2023-10-02 05:20:13 +03:00
parent ff8e937112
commit 28117b5159
2 changed files with 20 additions and 24 deletions

View File

@ -1804,13 +1804,6 @@ button.close {
.toast-body {
padding: 0.75rem;
}
.modal-open {
overflow: hidden !important;
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal {
position: fixed;
top: 0;
@ -1819,7 +1812,8 @@ button.close {
display: none;
width: 100%;
height: 100%;
overflow: hidden;
overflow-x: hidden;
overflow-y: auto;
outline: 0;
padding-right: 0 !important; /* fix Safari zoom issue */
}
@ -7681,12 +7675,6 @@ ul {
}
@media (min-width: 768px) {
.modal-open {
padding-right: 10px;
}
.modal-open nav {
padding-right: 10px;
}
::-webkit-scrollbar {
width: 10px;
}

View File

@ -1,3 +1,7 @@
if (location.hash.startsWith("#m-")) {
history.replaceState({}, '', location.href.split('#')[0])
}
const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value
function getMessageFromJsonData(success, json) {
@ -694,14 +698,18 @@ function enablePushNotifications() {
})
}
const body = document.getElementsByTagName('body')[0]
addEventListener('hashchange', () => {
if (location.hash.startsWith("#m-"))
body.classList.add('modal-open')
else
body.classList.remove('modal-open')
})
addEventListener('wheel', function (e) {
if (location.hash.startsWith("#m-")) {
e.preventDefault();
e.stopPropagation();
return false;
}
}, {passive: false});
if (location.hash.startsWith("#m-")) {
history.replaceState({}, '', location.href.split('#')[0])
}
addEventListener('touchmove', function (e) {
if (location.hash.startsWith("#m-")) {
e.preventDefault();
e.stopPropagation();
return false;
}
}, {passive: false});