This might be a newbie question. What I want to do iswatch if a particular element has custom scrollbar I want to change the width of its parent.This works perfectly if I wrap in setInterval as it will be checking all the time for changes, but I am concerned about performance. How this could be implemented more elegantly in jQuery or even Angularjs?
(function($) {
$.fn.hasScrollBar = function() {
return this.get(0).scrollHeight > this.height();
}
})(jQuery);
if ($('#tab-content-3').hasScrollBar()) {
$('#basics md-content').css('width', '95%');
} else {
$('#basics md-content').css('width', '100%');
}