Increase element width with jqLite

973 Views Asked by At

In my angularjs directive I want to increase DIV width if vertical scroll bar is visible. I did the following with jQuery:

var gridBody = gridElem.children().eq(1);
var scrollBarWidth = gridBody[0].offsetWidth - gridBody[0].clientWidth;
var lastCol = angular.element(gridElem[0].querySelector('.grid-header-last-cell'));
lastCol.width(lastCol.width() + scrollBarWidth);

It seems to work (not sure about cross browser issues). Notice that width() method is jQuery method but jqLite. How can I achieve the same result with jqLite only?

1

There are 1 best solutions below

1
On BEST ANSWER

The following worked:

lastCol.css('width', '+=' + scrollBarWidth);