How to prevent background scrolling when Bootstrap 3 modal open on mobile platforms? On desktop browsers the background is prevented from scrolling and works as it should.<
Had an issue with this as well, iPhone + Safari where needed to add:
position: fixed;
As mentioned elsewhere, this created a scroll-to-top issue. Fix that worked for me was to capture the position to top upon modal open, and then animate to that position on modal close
upon modal open:
scrollTo = $('body').scrollTop();
$('body').css("position", "fixed");
upon modal close
$('body').css("position", "static");
$('body').animate({scrollTop: scrollTo}, 0);