Search code examples
jqueryangularjsjqlite

Increase element width with jqLite


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?


Solution

  • The following worked:

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