Type: js
Google Analytics
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘XXXXXXX’);Continue reading
Real-time validation for restricting numbers from Single Line Text field
/** * Dynamically prevent numbers from being entered on single line text fields * * @link https://wpforms.com/developers/how-to-restrict-numbers-in-a-single-line-text-form-field/ */ function wpf_dev_restrict_numbers( ) { ?>Continue reading
Untitled Snippet
document.addEventListener(“DOMContentLoaded”, () => { const canvas = document.getElementById(“canvas”); const ctx = canvas.getContext(“2d”); const expressionInput = document.getElementById(“expressionInput”); const drawButton = document.getElementById(“drawButton”); const resetButton = document.getElementById(“resetButton”); const saveButton = document.getElementById(“saveButton”); const colorPicker = document.getElementById(“colorPicker”); const gridToggle = document.getElementById(“gridToggle”); let scaleX = 25;…Continue reading
Price Range Slider (JS)
document.addEventListener(‘DOMContentLoaded’, function() { const priceRangeSlider = document.getElementById(‘priceRangeSlider’); const priceDisplay = document.getElementById(‘priceDisplay’); const hiddenField = document.querySelector(‘input[name=”input_9″]’); priceRangeSlider.addEventListener(‘input’, function() { const value = this.value; priceDisplay.textContent = value; hiddenField.value = value; }); });Continue reading
samap.js
// Initialize the map function initMap() { const map = L.map(‘map’, { maxBounds: [ // Set the maximum boundaries for the map [40.32732, -92.46601], // Southwest corner coordinates [43.47062, -84.25403] // Northeast corner coordinates ] }).setView([42.78236, -87.12695], 8.5); // Add…Continue reading
Set a specific language for Cloudflare Turnstile.
/** * Set a specific language for Cloudflare Turnstile. * * @link https://wpforms.com/developers/how-to-set-the-language-for-cloudflare-turnstile */ function wpf_add_turnstile_language_script() { if (!wp_script_is(‘wpforms-recaptcha’, ‘enqueued’)) { return; } $language_code = ‘ar-eg’; // where ‘ar-eg’ is for Arabic (Egypt) language ?>Continue reading
Body on Scroll
;(function ($) { $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 5) { $(“body”).addClass(“scroll-500”); $(“.tm-header”).removeClass(“uk-blend-difference”); } else { $(“body”).removeClass(“scroll-500”); $(“.tm-header”).addClass(“uk-blend-difference”); } }); })(jQuery);Continue reading
Webhook smart tags
{ “smart_tags”: { “region”: “Gujarat”, “state”: “Gujarat”, “province”: “Gujarat”, “territory”: “Gujarat”, “region_code”: “GJ”, “country”: “India”, “country_code”: “IN”, “city”: “Vadodara”, “latitude”: 22.3008, “longitude”: 73.2043, “zip”: “390004”, “postal_code”: “390004”, “day”: “Friday”, “month”: “May”, “year”: “2024”, “date”: “May 31, 2024”, “page_url”: “https://giztale.com/”, “referer_url”:…Continue reading
“Lazy Load Images”.( For Dom Size)
document.addEventListener(“DOMContentLoaded”, function() { const lazyLoadImages = () => { const images = document.querySelectorAll(‘img.lazy’); const observer = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { const img = entry.target; img.src = img.dataset.src; img.classList.remove(‘lazy’); observer.unobserve(img); } }); }); images.forEach(img…Continue reading