mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-14 01:24:19 +02:00
test(Modal): reuse _getScrollbarWidth in tests
This commit is contained in:
@@ -13,14 +13,7 @@ $(function () {
|
|||||||
// Enable the scrollbar measurer
|
// Enable the scrollbar measurer
|
||||||
$('<style type="text/css"> .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll; } </style>').appendTo('head')
|
$('<style type="text/css"> .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll; } </style>').appendTo('head')
|
||||||
// Function to calculate the scrollbar width which is then compared to the padding or margin changes
|
// Function to calculate the scrollbar width which is then compared to the padding or margin changes
|
||||||
$.fn.getScrollbarWidth = function () {
|
$.fn.getScrollbarWidth = $.fn.modal.Constructor.prototype._getScrollbarWidth
|
||||||
var scrollDiv = document.createElement('div')
|
|
||||||
scrollDiv.className = 'modal-scrollbar-measure'
|
|
||||||
document.body.appendChild(scrollDiv)
|
|
||||||
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
|
|
||||||
document.body.removeChild(scrollDiv)
|
|
||||||
return scrollbarWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simulate scrollbars
|
// Simulate scrollbars
|
||||||
$('html').css('padding-right', '16px')
|
$('html').css('padding-right', '16px')
|
||||||
|
Reference in New Issue
Block a user