1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-17 07:45:52 +01:00
verdaccio/lib/GUI/js/header.js
2014-05-08 16:34:16 -05:00

29 lines
564 B
JavaScript

var $ = require('unopinionate').selector,
onScroll = require('onscroll');
$(function() {
var $header = $('header'),
$content = $('#content'),
bottomOffset = 52;
var scrollFunc = function(top) {
var limit = $header.outerHeight() - bottomOffset;
if(top < 0) {
$header.css('top', 0);
}
else if(top > limit) {
$header.css('top', -limit + 'px');
}
else {
$header.css('top', -top + 'px');
}
};
onScroll(scrollFunc);
scrollFunc();
$(window).resize(function() {
$content.css('margin-top', $header.outerHeight());
}).resize();
});