dynamicweb/static/blog.ungleich.ch/js/navbar-scroll-up.js
rscnt 6caea3c709 templates: added cms/ungleich.ch/base.html
This template holds the base structure for
every page in the site.

It expose the following blocks:

+ base_header:
    This block is used to display the big banner
    and title image for the main style of the site.
    When overriding this block always prefere the use
    of include, since the amount of markup needed for
    the header is quite a lot.
    For an example of what should be in this block
    look at: cms/ungleich.ch/_header_base.html.

+ block_content:
    Holds the main content for the page, it delcares a
    placeholder "default".

This commit also includes the following templates:

cms/ungleich.ch/_footer.html:
    Markup for the footer of the page.
    TODO: Social links.

cms/ungleich.ch/_header_base.html:
    Markup for the big image with the title and
    summary of the page.

cms/ungleich.ch/_menu.html:
    Markup for the main navigation markup for the
    entire site.

And the required static files.

Signed-off-by: rscnt <rascnt@gmail.com>
2015-05-23 04:09:39 -06:00

29 lines
952 B
JavaScript

// Navigation Scripts to Show Header on Scroll-Up
jQuery(document).ready(function($) {
var MQL = 1170;
//primary navigation slide-in effect
if ($(window).width() > MQL) {
var headerHeight = $('.navbar-custom').height();
$(window).on('scroll', {
previousTop: 0
},
function() {
var currentTop = $(window).scrollTop();
//check if user is scrolling up
if (currentTop < this.previousTop) {
//if scrolling up...
if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed')) {
$('.navbar-custom').addClass('is-visible');
} else {
$('.navbar-custom').removeClass('is-visible is-fixed');
}
} else {
//if scrolling down...
$('.navbar-custom').removeClass('is-visible');
if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed');
}
this.previousTop = currentTop;
});
}
});