Quantcast
Channel: Prevent BODY from scrolling when a modal is opened - Stack Overflow
Viewing latest article 23
Browse Latest Browse All 60

Answer by ibrahimyilmaz for Prevent BODY from scrolling when a modal is opened

$
0
0

This is the best solution for me:

Css:

.modal {
     overflow-y: auto !important;
}

And Js:

modalShown = function () {
    $('body').css('overflow', 'hidden');
},

modalHidden = function () {
    $('body').css('overflow', 'auto');
}

Viewing latest article 23
Browse Latest Browse All 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>