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

com.jwebmp.plugins.angularanimatedchange.animatedChange.js Maven / Gradle / Ivy

The newest version!
JW_APP_NAME.directive('animatedChange', animatedChange);

function animatedChange($timeout) {
    return {
        link: function (scope, element) {
            $timeout(function () {
                var newValue = element.attr('new-value');
                var oldvalue = parseInt(element.html());

                function changeValue(val) {
                    $timeout(function () {
                        element.html(val);
                    }, 30);
                }

                if (newValue > oldvalue) {
                    for (var i = oldvalue; i <= newValue; i++) {
                        changeValue(i);
                    }
                } else {
                    for (var j = oldvalue; j >= newValue; j--) {
                        changeValue(j);
                    }
                }
                $timeout(function () {
                    element.next().find('i').addClass('show-arr');
                }, 500);
            }, 3500);
        }
    };
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy