Welcome to mirror list, hosted at ThFree Co, Russian Federation.

header.js « js « assets - github.com/ThemeTony/hugo-theme-tony.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2716ecada14c6e0bfa906c01b56d8a6f6e91e5cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var $header = $('#header-div'),
    $readingBar = $('#reading-bar'),
    $SY = $(window).scrollTop();
function setHeader(type) {
    $header.attr('class','tony-header-' + type);
}
$(window).scroll(function () {
    $SY = $(window).scrollTop();
    if ($readingBar) {
        $readingBar.attr('style', 'width: ' + $(document).scrollTop()/($(document).height()-$(window).height())*100 + '%');
    }
    if ($SY > 0) setHeader('scroll');
    else setHeader('fixed');
});
$header.hover(function () {
    setHeader('scroll');
});
$header.mouseout(function () {
    if($SY === 0) setHeader('fixed');
});