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
// ANIMATE ANCHOR SCROLL | |
const $root = $('html, body'); | |
function animateScroll(yPos, speed) { | |
$root.animate({ | |
scrollTop: yPos | |
}, speed); | |
} | |
// Stops the page load and animates scroll | |
$('ul#main-menu').on('click', 'a[href^="#"]', function(e) { |
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
// ANIMATE TO THE TOP | |
$('button#to-top').on('click', function(e) { | |
animateScroll(0, 650); | |
// GA Custom Click Tracking | |
gtag('event','Click',{'event_category':'clicktrack','event_label':'Up Arrow'}); | |
}) |
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
// Library url: https://animate.style/ | |
// SCROLL ANIMATION | |
// Check if element is scrolled into view | |
function isScrolledIntoView(elem) { | |
var docViewTop = $(window).scrollTop(); | |
var docViewBottom = docViewTop + $(window).height(); | |
var elemTop = $(elem).offset().top; | |
var elemBottom = elemTop + $(elem).height(); |
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
/* | |
Add this to functions.php | |
function enqueue_scripts() { | |
wp_enqueue_script( 'vimeo-api', '//player.vimeo.com/api/player.js', true); | |
} | |
*/ | |
// Vimeo API Documentation: https://developer.vimeo.com/api/reference | |
// Pause video on modal close |
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
var alerted = getWithExpiry('covid19'); | |
if (alerted != 'yes') { | |
$('.alert-dismissible.orange-bg.pr-0').addClass('d-flex'); | |
} | |
$('body').on('close.bs.alert', '.alert-dismissible.orange-bg.pr-0', function () { | |
// localStorage.setItem('covid19','yes'); | |
setWithExpiry('covid19', 'yes', 3600000) | |
}); |