Fixes some typos in JavaScript sources
This commit is contained in:
parent
cfe82cfc7f
commit
ea3d3cb471
24
js/main.js
24
js/main.js
@ -5,13 +5,13 @@ jQuery(document).ready(function($) {
|
||||
// This applies only if secondary nav is below intro section
|
||||
belowNavHeroContent = $('.sub-nav-hero'),
|
||||
headerHeight = mainHeader.height();
|
||||
|
||||
|
||||
// Set scrolling variables
|
||||
var scrolling = false,
|
||||
previousTop = 0,
|
||||
currentTop = 0;
|
||||
|
||||
const SCROLLDELTA = 10, SCROLLOFFSET = 150;
|
||||
|
||||
const SCROLL_DELTA = 10, SCROLL_OFFSET = 150;
|
||||
|
||||
mainHeader.on('click', '.nav-trigger', function(event) {
|
||||
// Open primary navigation on mobile
|
||||
@ -45,11 +45,11 @@ jQuery(document).ready(function($) {
|
||||
|
||||
function checkSimpleNavigation(currentTop) {
|
||||
// There's no secondary nav OR secondary nav is below primary nav
|
||||
if(previousTop - currentTop > SCROLLDELTA) {
|
||||
if(previousTop - currentTop > SCROLL_DELTA) {
|
||||
// If scrolling up...
|
||||
mainHeader.removeClass('is-hidden');
|
||||
}
|
||||
else if(currentTop - previousTop > SCROLLDELTA && currentTop > SCROLLOFFSET) {
|
||||
else if(currentTop - previousTop > SCROLL_DELTA && currentTop > SCROLL_OFFSET) {
|
||||
// If scrolling down...
|
||||
mainHeader.addClass('is-hidden');
|
||||
}
|
||||
@ -58,32 +58,32 @@ jQuery(document).ready(function($) {
|
||||
function checkStickyNavigation(currentTop) {
|
||||
// Secondary nav below intro section - sticky secondary nav
|
||||
var secondaryNavOffsetTop = belowNavHeroContent.offset().top - secondaryNavigation.height() - mainHeader.height();
|
||||
|
||||
|
||||
if(previousTop >= currentTop) {
|
||||
// If scrolling up...
|
||||
// If scrolling up...
|
||||
if(currentTop < secondaryNavOffsetTop) {
|
||||
// Secondary nav is not fixed
|
||||
mainHeader.removeClass('is-hidden');
|
||||
secondaryNavigation.removeClass('fixed slide-up');
|
||||
belowNavHeroContent.removeClass('secondary-nav-fixed');
|
||||
}
|
||||
else if(previousTop - currentTop > SCROLLDELTA) {
|
||||
else if(previousTop - currentTop > SCROLL_DELTA) {
|
||||
// Secondary nav is fixed
|
||||
mainHeader.removeClass('is-hidden');
|
||||
secondaryNavigation.removeClass('slide-up').addClass('fixed');
|
||||
secondaryNavigation.removeClass('slide-up').addClass('fixed');
|
||||
belowNavHeroContent.addClass('secondary-nav-fixed');
|
||||
}
|
||||
}
|
||||
else {
|
||||
// If scrolling down...
|
||||
if(currentTop > secondaryNavOffsetTop + SCROLLOFFSET) {
|
||||
// If scrolling down...
|
||||
if(currentTop > secondaryNavOffsetTop + SCROLL_OFFSET) {
|
||||
// Hide primary nav
|
||||
mainHeader.addClass('is-hidden');
|
||||
secondaryNavigation.addClass('fixed slide-up');
|
||||
belowNavHeroContent.addClass('secondary-nav-fixed');
|
||||
}
|
||||
else if(currentTop > secondaryNavOffsetTop) {
|
||||
// Once the secondary nav is fixed, do not hide primary nav if you haven't scrolled more than SCROLLOFFSET
|
||||
// Once the secondary nav is fixed, do not hide primary nav if you haven't scrolled more than SCROLL_OFFSET
|
||||
mainHeader.removeClass('is-hidden');
|
||||
secondaryNavigation.addClass('fixed').removeClass('slide-up');
|
||||
belowNavHeroContent.addClass('secondary-nav-fixed');
|
||||
|
@ -6,7 +6,7 @@ jQuery(document).ready(function($) {
|
||||
// Hide timeline blocks which are outside the viewport
|
||||
hideBlocks(timelineBlocks, OFFSET);
|
||||
|
||||
// On scolling, show & animate timeline blocks when enter the viewport
|
||||
// On scrolling, show & animate timeline blocks when enter the viewport
|
||||
$(window).on('scroll', function() {
|
||||
!window.requestAnimationFrame
|
||||
? setTimeout(function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user