Suma
(Suma)
May 31, 2017, 1:22am
1
Hi everyone, I disabled scrolling under a custom made modal with custom code, but if my modal has a lot of elements this is not scrollable either, how can I disable scroll on anything but the modal div?
samliew
(webflowexpert.com)
May 31, 2017, 1:27am
2
1 Like
Suma
(Suma)
May 31, 2017, 1:40am
3
Hi, thanks, sorry for the flood post this days; I found the solution as explained by Danro here for anyone interested.
Hi guys, this can be accomplished by setting the overflow property of the <html> tag.
Here’s a quick example showing how you might do this using custom code:
<script>
var $html = $(document.documentElement);
var $modal = $('.my-custom-modal');
function showModal() {
$html.css('overflow', 'hidden');
$modal.show().css('overflow', 'auto');
}
function hideModal() {
$html.css('overflow', '');
$modal.hide();
}
$('.modal-open-button').on('click', showModal);
$('.modal-close-button').on('c…