The solution from @steve did not work for me despite my issue being identical to @Stephanie.
Restating the problem that Stephanie and I share:
I have long bootstrap modals. On small screens the modals cannot be seen in their entirety without scrolling. By default in bootstrap modals are position:fixed. I can allow them to be scrolled by changing this to position:absolute.
But now I have a new problem. My pages are long too, and when I fire the modal from the bottom of the page the modal is appearing at the top of the page, out of the current browser view.
So to fix both of these:
css:
// allows the modal to be scrolled
.modal {position: absolute;}
javascript/jQuery:
// jumps browser window to the top when modal is fired
$('body').on('show', '.modal', function(){
$('body').scrollTop(0);
});
But it turns out that Firefox does not like 'body' as a selector for scrollTop, but does like 'html'. Webkit operates conversely. Using a comment from here: Animate scrollTop not working in firefox
Since I am using jQuery < 1.9 I can do browser sniffing to solve this:
// jumps browser window to the top when modal is fired
$('body').on('show', '.modal', function(){
// Firefox wants 'html', others want 'body'
$(jQuery.browser.mozilla ? "html" : "body").scrollTop(0);
});
Now when the modals are fired they appear at the top of the page, the browser window scrolls up to expose them, but the user can still scroll down if their screen is too small to display the entire length of the modal.