-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update prettier config * Run pre-commit
- Loading branch information
1 parent
1963dc1
commit cf4da9b
Showing
8 changed files
with
604 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,110 @@ | ||
//Preloader | ||
$(window).on('load', function() { // makes sure the whole site is loaded | ||
$('#status').fadeOut(); // will first fade out the loading animation | ||
$('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website. | ||
$('body').delay(350).css({'overflow':'visible'}); | ||
}) | ||
$(window).on("load", function () { | ||
// makes sure the whole site is loaded | ||
$("#status").fadeOut(); // will first fade out the loading animation | ||
$("#preloader").delay(350).fadeOut("slow"); // will fade out the white DIV that covers the website. | ||
$("body").delay(350).css({ overflow: "visible" }); | ||
}); | ||
|
||
$(document).ready(function(){ | ||
//Mobile menu toggle | ||
if ($('.navbar-burger').length) { | ||
$('.navbar-burger').on("click", function(){ | ||
|
||
var menu_id = $(this).attr('data-target'); | ||
$(this).toggleClass('is-active'); | ||
$("#"+menu_id).toggleClass('is-active'); | ||
$('.navbar.is-light').toggleClass('is-dark-mobile') | ||
}); | ||
} | ||
|
||
//reveal elements on scroll so animations trigger the right way | ||
var $window = $(window), | ||
win_height_padded = $window.height() * 1.1; | ||
$(document).ready(function () { | ||
//Mobile menu toggle | ||
if ($(".navbar-burger").length) { | ||
$(".navbar-burger").on("click", function () { | ||
var menu_id = $(this).attr("data-target"); | ||
$(this).toggleClass("is-active"); | ||
$("#" + menu_id).toggleClass("is-active"); | ||
$(".navbar.is-light").toggleClass("is-dark-mobile"); | ||
}); | ||
} | ||
|
||
$window.on('scroll', revealOnScroll); | ||
//reveal elements on scroll so animations trigger the right way | ||
var $window = $(window), | ||
win_height_padded = $window.height() * 1.1; | ||
|
||
function revealOnScroll() { | ||
var scrolled = $window.scrollTop(); | ||
$(".revealOnScroll:not(.animated)").each(function () { | ||
var $this = $(this), | ||
offsetTop = $this.offset().top; | ||
$window.on("scroll", revealOnScroll); | ||
|
||
if (scrolled + win_height_padded > offsetTop) { | ||
if ($this.data('timeout')) { | ||
window.setTimeout(function(){ | ||
$this.addClass('animated ' + $this.data('animation')); | ||
}, parseInt($this.data('timeout'),10)); | ||
} else { | ||
$this.addClass('animated ' + $this.data('animation')); | ||
} | ||
} | ||
}); | ||
} | ||
function revealOnScroll() { | ||
var scrolled = $window.scrollTop(); | ||
$(".revealOnScroll:not(.animated)").each(function () { | ||
var $this = $(this), | ||
offsetTop = $this.offset().top; | ||
|
||
// Back to Top button behaviour | ||
var pxShow = 600; | ||
var scrollSpeed = 500; | ||
$(window).on("scroll", function() { | ||
if ($(window).scrollTop() >= pxShow) { | ||
$("#backtotop").addClass('visible'); | ||
if (scrolled + win_height_padded > offsetTop) { | ||
if ($this.data("timeout")) { | ||
window.setTimeout( | ||
function () { | ||
$this.addClass("animated " + $this.data("animation")); | ||
}, | ||
parseInt($this.data("timeout"), 10), | ||
); | ||
} else { | ||
$("#backtotop").removeClass('visible'); | ||
$this.addClass("animated " + $this.data("animation")); | ||
} | ||
} | ||
}); | ||
$('#backtotop a').on('click', function() { | ||
$('html, body').animate({ | ||
scrollTop: 0 | ||
}, scrollSpeed); | ||
return false; | ||
}); | ||
} | ||
|
||
// Back to Top button behaviour | ||
var pxShow = 600; | ||
var scrollSpeed = 500; | ||
$(window).on("scroll", function () { | ||
if ($(window).scrollTop() >= pxShow) { | ||
$("#backtotop").addClass("visible"); | ||
} else { | ||
$("#backtotop").removeClass("visible"); | ||
} | ||
}); | ||
$("#backtotop a").on("click", function () { | ||
$("html, body").animate( | ||
{ | ||
scrollTop: 0, | ||
}, | ||
scrollSpeed, | ||
); | ||
return false; | ||
}); | ||
|
||
// Select all links with hashes | ||
$('a[href*="#"]') | ||
// Select all links with hashes | ||
$('a[href*="#"]') | ||
// Remove links that don't actually link to anything | ||
.not('[href="#"]') | ||
.not('[href="#0"]') | ||
.on("click", function(event) { | ||
// On-page links | ||
if ( | ||
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') | ||
&& | ||
location.hostname == this.hostname | ||
) { | ||
// Figure out element to scroll to | ||
var target = $(this.hash); | ||
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); | ||
// Does a scroll target exist? | ||
if (target.length) { | ||
// Only prevent default if animation is actually gonna happen | ||
event.preventDefault(); | ||
$('html, body').animate({ | ||
scrollTop: target.offset().top | ||
}, 550, function() { | ||
// Callback after animation | ||
// Must change focus! | ||
var $target = $(target); | ||
$target.focus(); | ||
if ($target.is(":focus")) { // Checking if the target was focused | ||
return false; | ||
} else { | ||
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable | ||
$target.focus(); // Set focus again | ||
}; | ||
}); | ||
} | ||
.not('[href="#"]') | ||
.not('[href="#0"]') | ||
.on("click", function (event) { | ||
// On-page links | ||
if ( | ||
location.pathname.replace(/^\//, "") == | ||
this.pathname.replace(/^\//, "") && | ||
location.hostname == this.hostname | ||
) { | ||
// Figure out element to scroll to | ||
var target = $(this.hash); | ||
target = target.length | ||
? target | ||
: $("[name=" + this.hash.slice(1) + "]"); | ||
// Does a scroll target exist? | ||
if (target.length) { | ||
// Only prevent default if animation is actually gonna happen | ||
event.preventDefault(); | ||
$("html, body").animate( | ||
{ | ||
scrollTop: target.offset().top, | ||
}, | ||
550, | ||
function () { | ||
// Callback after animation | ||
// Must change focus! | ||
var $target = $(target); | ||
$target.focus(); | ||
if ($target.is(":focus")) { | ||
// Checking if the target was focused | ||
return false; | ||
} else { | ||
$target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable | ||
$target.focus(); // Set focus again | ||
} | ||
}, | ||
); | ||
} | ||
} | ||
}); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.