var header; var logo, logoNeg; window.isHomepage = false; //includes method polyfill for ie 11 and below if (!String.prototype.includes) { String.prototype.includes = function(search, start) { 'use strict'; if (search instanceof RegExp) { throw TypeError('first argument must not be a RegExp'); } if (start === undefined) { start = 0; } return this.indexOf(search, start) !== -1; }; } $(document).ready(function(){ $(this).scrollTop(0); $("a").each(function(){ // add download attributes to pdf a tags if(/.+\.pdf$/g.test($(this).prop("href"))){ $(this).prop("download", true) } }) }); //includes method polyfill for ie 11 and below window.onload = function(){ //homepage logo hide and show header = document.getElementById("header"); //homepage logo hide and show //social media buttons floating on right var sharingButton = document.querySelector(".social__sharing__share"); var socialButtons = document.querySelector(".social__buttons"); sharingButton.addEventListener("click", function(e){ e.preventDefault(); if(socialButtons.classList.contains("hide")){ socialButtons.classList.remove("hide"); sharingButton.classList.add("social__dark"); } else { socialButtons.classList.add("hide"); sharingButton.classList.remove("social__dark"); } }) } // window.onload finish window.onscroll = function() {toggleHeader()}; function toggleHeader() { if (window.pageYOffset > 200) { header.classList.add("sticky"); } else { header.classList.remove("sticky"); } }