modalを使うと、背景がスクロールしてしまう。
これはご遠慮願いたい。
<script>
var current_scrollY;
$(function () {
// modalを開いた時
$('#profile-modal').on('shown.bs.modal', function (event) {
current_scrollY = $( window ).scrollTop();
$('body').css( {
position: 'fixed',
width: '100%',
top: -1 * current_scrollY
} );
});
// modalを閉じた時
$('#profile-modal').on('hidden.bs.modal', function (event) {
$( 'body' ).attr( { style: '' } );
$( 'html, body' ).prop( { scrollTop: current_scrollY } );
});
});
</script>
これでOK