mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
29 lines
No EOL
564 B
JavaScript
29 lines
No EOL
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();
|
|
}); |