All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jwebmp.plugins.angulartrackwidth.trackWidth.js Maven / Gradle / Ivy

There is a newer version: 1.2.2.1-jre17
Show newest version
JW_APP_NAME.directive('trackWidth', trackWidth);

function trackWidth() {
    return {
        scope: {
            trackWidth: '=',
            minWidth: '='
        },
        link: function (scope, element) {
            scope.trackWidth = $(element).width() < scope.minWidth;
            scope.prevTrackWidth = scope.trackWidth;

            $(window).resize(function () {
                var trackWidth = $(element).width() < scope.minWidth;
                if (trackWidth !== scope.prevTrackWidth) {
                    scope.$apply(function () {
                        scope.trackWidth = trackWidth;
                    });
                }
                scope.prevTrackWidth = trackWidth;
            });
        }
    };
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy