Remove scrollbar padding when no scrollbar is present

master
Vitaliy Filippov 2015-07-27 13:21:16 +03:00
parent 6000bfe16c
commit 5c43d85281
1 changed files with 14 additions and 8 deletions

View File

@ -143,12 +143,6 @@
$divHead = $wrapper.find('div.fht-thead'); $divHead = $wrapper.find('div.fht-thead');
} }
helpers._setupClone($divHead, tableProps.thead);
$self.css({
'margin-top': -$divHead.outerHeight(true)
});
/* /*
* Check for footer * Check for footer
* Setup footer if present * Setup footer if present
@ -165,6 +159,19 @@
var tbodyHeight = $wrapper.height() - $thead.outerHeight(true) - tfootHeight - tableProps.border; var tbodyHeight = $wrapper.height() - $thead.outerHeight(true) - tfootHeight - tableProps.border;
if ($self.height() - $divHead.outerHeight(true) <= tbodyHeight) {
// Remove scrollbar padding
$divHead.find('table.fht-table')
.css({ width: widthMinusScrollbar });
settings.scrollbarOffset = 0;
}
helpers._setupClone($divHead, tableProps.thead);
$self.css({
'margin-top': -$divHead.outerHeight(true)
});
$divBody.css({ $divBody.css({
'height': tbodyHeight 'height': tbodyHeight
}); });
@ -613,9 +620,8 @@
* to align with the scrollbar of the body * to align with the scrollbar of the body
*/ */
if (!$(this).closest('.fht-tbody').length && $(this).is(':last-child') && !$(this).closest('.fht-fixed-column').length) { if (!$(this).closest('.fht-tbody').length && $(this).is(':last-child') && !$(this).closest('.fht-fixed-column').length) {
var padding = Math.max((($(this).innerWidth() - $(this).width()) / 2), settings.scrollbarOffset);
$(this).css({ $(this).css({
'padding-right': parseInt($(this).css('padding-right')) + padding + 'px' 'padding-right': parseInt($(this).css('padding-right')) + settings.scrollbarOffset + 'px'
}); });
} }
}); });