@yandex/ui
Version:
Yandex UI components
11 lines (10 loc) • 372 B
JavaScript
export var calculateItemWidth = function (element, withMargins) {
if (!(element && element.current))
return 0;
var style = window.getComputedStyle(element.current);
var width = parseInt(style.width || '0');
if (withMargins) {
return width + parseInt(style.marginLeft || '0') + parseInt(style.marginRight || '0');
}
return width;
};