Skip to content

Instantly share code, notes, and snippets.

@vladfil
Created November 29, 2017 08:07
Show Gist options
  • Select an option

  • Save vladfil/6347b727fa3dc6b20653504d2e0464c3 to your computer and use it in GitHub Desktop.

Select an option

Save vladfil/6347b727fa3dc6b20653504d2e0464c3 to your computer and use it in GitHub Desktop.
if ($.browser.mobile) {
var scrollPos = 0;
$('#contactModal')
.on('show.bs.modal', function () {
scrollPos = pageYOffset || (document.documentElement.clientHeight ? document.documentElement.scrollTop : document.body.scrollTop);
$('body').css({
overflow: 'hidden',
width: '100%',
position: 'fixed',
top: -scrollPos
});
})
.on('hide.bs.modal', function () {
$('body').css({
overflow: '',
width: '',
position: '',
top: ''
}).scrollTop(scrollPos);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment