Tuesday, 14 August 2018

checking if an element contains overflow & appling a style


elements that need to be checked to see if they have any overflow have the .mark-if-overflow class applied to them.

function CheckAllCellsForOverflow() {
    $(".mark-if-overflow .cell-wrapper").each(function (index) {
        if (($(this).prop('scrollWidth') > $(this).width()) || ($(this).prop('scrollHeight') > $(this).height())) {
            $(this).addClass('contains-hidden-overflow');
        } else {
            $(this).removeClass('contains-hidden-overflow');
        }
    });
}

No comments:

Post a Comment