Skip to content

Make header scroll logic generic #2

@waldenraines

Description

@waldenraines

We should make the header scroll logic in the alchMenu directive generic and include it in a utils package. I am currently re-using it in Katello thusly:

angular.module('alchemy').directive('scrollWithPage', ['$window', function ($window) {
    return {
        link: function (scope, element){
            var element_original_offset = $(element).offset().top;
            angular.element($window).bind('scroll', function () {
                var window_scroll_top = $($window).scrollTop();
                if (window_scroll_top > element_original_offset) {
                    element.addClass('scrolling');
                } else {
                    element.removeClass('scrolling');
                }
            });
        }
    };
}]);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions