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 { .toast-body {
padding: 0.75rem; padding: 0.75rem;
} }
.modal-open {
overflow: hidden !important;
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal { .modal {
position: fixed; position: fixed;
top: 0; top: 0;
@ -1819,7 +1812,8 @@ button.close {
display: none; display: none;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow-x: hidden;
overflow-y: auto;
outline: 0; outline: 0;
padding-right: 0 !important; /* fix Safari zoom issue */ padding-right: 0 !important; /* fix Safari zoom issue */
} }
@ -7681,12 +7675,6 @@ ul {
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.modal-open {
padding-right: 10px;
}
.modal-open nav {
padding-right: 10px;
}
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; 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 const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value
function getMessageFromJsonData(success, json) { function getMessageFromJsonData(success, json) {
@ -694,14 +698,18 @@ function enablePushNotifications() {
}) })
} }
const body = document.getElementsByTagName('body')[0] addEventListener('wheel', function (e) {
addEventListener('hashchange', () => { if (location.hash.startsWith("#m-")) {
if (location.hash.startsWith("#m-")) e.preventDefault();
body.classList.add('modal-open') e.stopPropagation();
else return false;
body.classList.remove('modal-open') }
}) }, {passive: false});
if (location.hash.startsWith("#m-")) { addEventListener('touchmove', function (e) {
history.replaceState({}, '', location.href.split('#')[0]) if (location.hash.startsWith("#m-")) {
} e.preventDefault();
e.stopPropagation();
return false;
}
}, {passive: false});