Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
modal safari
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