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
/* Give section an attribute of "data-cms-section" */ | |
[data-cms-section]:not(:has(.w-dyn-item)) { | |
display: none; | |
} |
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 code source and use agreement here: https://gist.github.com/rileyrichter/b2e5b5d9fe8952372ce49fafc75dea8b | |
const canonical = document.querySelector('link[rel="canonical"]'); | |
const urlParams = new URLSearchParams(window.location.search); | |
const paginationParam = Array.from(urlParams.entries()).find(([key]) => | |
/^[a-z0-9]{8}_page$/.test(key) | |
); | |
if (paginationParam) { | |
const canonical = document.querySelector('link[rel="canonical"]'); |
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
// Target the preloader element | |
const preloaderElement = document.getElementById('preloader'); | |
// Set the amount of time to wait in milliseconds | |
// Test by changing to 1 * 60 * 1000 for 1 min | |
const waitTime = 24 * 60 * 60 * 1000; // 24 hours | |
// Check if the local storage item is present and valid | |
if (!localStorage.getItem('preloaderShown') || Date.now() - localStorage.getItem('preloaderShown') > | |
waitTime) { |
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
// Validate email field for only business emails | |
document.addEventListener("DOMContentLoaded", function () { | |
// UPDATE THIS - ID on the <form> | |
let form = document.getElementById("pardot-form"); | |
// UPDATE THIS - ID on text element to display errors | |
let errorElement = document.getElementById("email-domain-error"); | |
form.addEventListener("submit", function (event) { | |
// UPDATE THIS - ID on the email <input> | |
let emailInput = document.getElementById("email"); |
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
<!-- Place this in the <head> and update the href to your images for each color mode --> | |
<link href="favicon-light.png" rel="icon" media="(prefers-color-scheme: light)" /> | |
<link href="favicon-dark.png" rel="icon" media="(prefers-color-scheme: dark)" /> |
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
// See test example of this here: https://codepen.io/cmoen89/pen/Baxdwxe?editors=1010 | |
$(function () { | |
$( "a[data-clean='remove-http']" ).each(function() { | |
var clean = $(this).text().replace(/^\/\/|^.*?:(\/\/)?/, ''); | |
$(this).text(clean); | |
}); | |
}); |
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
function responsiveScript() { | |
// only run script below 767 px screen width | |
if (window.innerWidth <= 767) { | |
// do something awesome on mobile only here | |
} | |
} | |
// run script on page load | |
responsiveScript(); | |
// run script on window resize | |
window.addEventListener("resize", responsiveScript); |
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
/* Set aspect ratio on an element/class */ | |
.div { | |
aspect-ratio: 16 / 9; | |
} | |
/* Minimum aspect ratio */ | |
@media (min-aspect-ratio: 8/5) { | |
div { | |
background: #9af; /* blue */ | |
} |
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
$(function() { | |
//run when form submits - ID must be on the <form> element! | |
$("#your-form").submit(function(event) { | |
//store email input value | |
var emailValue = $("#email").val(); | |
//redirect to sign up | |
window.location.replace("example.com/signup?email=" + emailValue); |
NewerOlder