精選文章

bcp大量匯出與匯入資料庫資料方法

--匯出-- bcp "select * from [資料庫名稱].[dbo].[資料表名稱]" queryout 匯出檔案名稱.txt -w -U "使用者帳號" -P "使用者密碼" " "...

2018年10月24日 星期三

bootstrap點彈跳視窗時,會出現element.style{padding-right:17px} 問題

問題:
bootstrap點彈跳視窗時,會出現element.style{padding-right:17px} 使整個頁面右邊會越來越往左偏移
說明:
遇到的專案是有使用sweetalert,所以使用方法5的方法有自訂了一下, 不然也可以參考該網址

https://stackoverflow.com/questions/32862394/bootstrap-modals-keep-adding-padding-right-to-body-after-closed


https://forums.oscommerce.com/topic/412058-modal-destination-and-modal-within-modal/

解決方法:
方法1
body {
padding-right: 0 !important;
overflow-y: scroll!important;
}

方法2
body,body.swal2-shown,body.modal-open {
overflow:inherit;
padding-right:inherit !important;
}

方法3
$(document.body).on('hide.bs.modal,hidden.bs.modal', function () {
$('body').css('padding-right', '0');
});

方法4
('.modal').on('hide.bs.modal', function (e) {
e.stopPropagation();
$('body').css('padding-right', '');
});

方法5
body, body.swal2-shown, body.modal-open {
padding-right: 0 !important;
overflow-y: scroll !important;
}