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
import { useState, useEffect } from "react"; | |
import Router from "next/router"; | |
const Layout = props => { | |
const [isLoading, setIsLoading] = useState(false); | |
useEffect(() => { | |
const updateLoadingStatus = () => setIsLoading(!isLoading); | |
Router.events.on("routeChangeStart", updateLoadingStatus); |
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
let links = document.querySelectorAll('#footer a'); | |
const substr_href = "mailto:"; | |
const substr_tel = "tel:"; | |
for(let i = 0; i < links.length; i++) { | |
let link = links[i]; | |
if(link.href.indexOf(substr_href) !== -1 || link.href.indexOf(substr_tel !== -1)) { | |
link.addEventListener('click', function() { |
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 btns = document.querySelectorAll('.btn'); | |
for(var i = 0; i < btns.length; i++) { | |
btns[i].addEventListener('click', function() { | |
// Do stuff | |
}); | |
} |
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
dataLayer.push({ | |
'Dimension1': 'Value1', // Custom dimensions | |
'Dimension2': 'Value2', | |
'ecommerce': { // Google Analytics Enhanced Ecommerce object | |
'purchase': { | |
'actionField': { | |
'id': 'XYZ123', // Transaction ID | |
'revenue': '30.00', // Total purchase revenue | |
'tax': '2.00' | |
}, |
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
$(".nav-link").click(function(){ | |
var el = $(this).attr("href"); | |
$("html, body").animate({ | |
scrollTop: $(el).offset().top | |
}, 700); | |
return false; | |
}); |
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
// Returns an object with all URL parameters, or error message if none are found | |
function getURLParams() { | |
if(!window.location.search) { return "No URL parameters found."; } | |
var paramsArr = window.location.search.substr(1).split("&"), | |
params = {}; | |
paramsArr.forEach(function(e) { | |
var a = e.split("="); | |
params[a[0]] = a[1]; |