gtag im header – neu/vanilla

(function () { ‘use strict’; function push(obj) { window.dataLayer = window.dataLayer || []; window.dataLayer.push(obj); } function stripUrl(href) { return (href || ”).replace(/^(https?:\/\/)?(www\.)?/, ”); } function currentTabAnchor(el) { var tabs = el.closest(‘.su-tabs’); var cur = tabs && tabs.querySelector(‘.su-tabs-current’); return cur &&…Continue reading

Script Header

document.addEventListener(‘DOMContentLoaded’, function() { const firstHeader = document.querySelector(‘.first-header’); const secondHeader = document.querySelector(‘.second-header’); if (!firstHeader || !secondHeader) return; // Check if mobile const isMobile = window.innerWidth SCROLL_THRESHOLD && !isSecondHeaderVisible) { isSecondHeaderVisible = true; // First header slides up and fades firstHeader.style.transition =…Continue reading

Open external links in new tab

document.addEventListener(“DOMContentLoaded”, function() { var links = document.querySelectorAll(“a[href]”); links.forEach(function(link) { if (link.hostname !== window.location.hostname) { link.setAttribute(“target”, “_blank”); link.setAttribute(“rel”, “noopener noreferrer”); } }); });Continue reading

Jostar Kitchen Reno Budget Calculator

(function(){ /* ===== Gravity Forms settings: replace the numbers with your form and field IDs ===== */ var JKR_GF={ formId: 0, /* e.g. 7 */ fields:{ /* Hidden field IDs from the form editor */ home:0, scope:0, budget:0, contingency:0, total:0,…Continue reading

Jostar Kitchen Reno Budget Calculator

(function(){ /* ===== Gravity Forms settings: replace the numbers with your form and field IDs ===== */ var JKR_GF={ formId: 0, /* e.g. 7 */ fields:{ /* Hidden field IDs from the form editor */ home:0, scope:0, budget:0, contingency:0, total:0,…Continue reading

GSAP Data Scroll Speed X+Y and Opacity (JS)

gsap.registerPlugin(ScrollTrigger); (() => { const maxScroll = () => ScrollTrigger.maxScroll(window); const H_DIR = 1; // flip all horizontal directions by setting to -1 // Any element with these attributes will be animated const targets = gsap.utils.toArray( “[data-speed], [data-speed-x], [data-speed-y], [data-opacity],…Continue reading

Add GA click events

document.addEventListener(‘click’, function (e) { const a = e.target.closest(‘a’); if (!a) return; if (a.href.startsWith(‘tel:’)) { gtag(‘event’, ‘click_phone’, { link_url: a.href }); } if (a.href.startsWith(‘mailto:’)) { gtag(‘event’, ‘click_email’, { link_url: a.href }); } });Continue reading