Created
March 20, 2017 14:46
-
-
Save AlekseyDevksh/3568ea47dc71aba14d24ced4ee56ee61 to your computer and use it in GitHub Desktop.
modal safari
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scrollPos = 0; | |
$('.modal') | |
.on('show.bs.modal', function (){ | |
scrollPos = $('body').scrollTop(); | |
$('body').css({ | |
overflow: 'hidden', | |
position: 'fixed', | |
top : -scrollPos | |
}); | |
}) | |
.on('hide.bs.modal', function (){ | |
$('body').css({ | |
overflow: '', | |
position: '', | |
top: '' | |
}).scrollTop(scrollPos); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment