0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/lib/GUI/js/header.js
2014-05-08 15:41:59 -05:00

30 lines
No EOL
589 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() {
console.log('resize');
$content.css('margin-top', $header.outerHeight());
}).resize();
});