~mpontillo/maas/migrate-dns-settings-1.8

« back to all changes in this revision

Viewing changes to src/maasserver/static/js/angular/directives/sticky_header.js

  • Committer: MAAS Lander
  • Author(s): Blake Rouse
  • Date: 2015-06-03 14:18:36 UTC
  • mfrom: (3980.2.1 fix-1461258)
  • Revision ID: maas_lander-20150603141836-z1fayhojbfibb7v9
[r=andreserl][bug=1461258][author=blake-rouse] Don't initialize the header height to the current value of the element. Reset the padding-top on destroy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
            var EXTRA_OFFSET = 20;
20
20
 
21
21
            // Current height of the header.
22
 
            var headerHeight = element.height();
 
22
            var headerHeight = -1;
23
23
 
24
24
            // Wrapper element. Grab the element from the root element, if that
25
25
            // fails search for the element as a parent of this directives.
97
97
            };
98
98
            checkHeaderHeight();
99
99
 
100
 
            // Clear the timeouts when the scope is destroyed.
 
100
            // Clear the timeouts and remove the padding-top on the wrapper
 
101
            // element when the scope is destroyed.
101
102
            scope.$on("$destroy", function() {
102
103
                clearTimeout(nextCheck);
103
104
                if(angular.isDefined(nextUpdate)) {
104
105
                    clearTimeout(nextUpdate);
105
106
                }
 
107
                wrapperElement.css("padding-top", "");
106
108
            });
107
109
        }
108
110
    };