1/** 2 * StudioSwift Main Scripts 3 * 4 * @package StudioSwift 5 */ 6 7(function ($) { 8 "use strict"; 9 10 /** 11 * Initialize on document ready 12 */ 13 $(document).ready(function () { 14 // Mobile menu toggle 15 initMobileMenu(); 16 // Lazy load images 17 initLazyLoad(); 18 }); 19 20 $(window).on("load", function () { 21 // Smooth scroll for anchor links 22 initSmoothScroll(); 23 }); 24 25 /** 26 * Mobile menu initialization 27 */ 28 function initMobileMenu() { 29 $(".mobile-menu-toggle").on("click", function () { 30 $(this).toggleClass("active"); 31 $(".primary-menu").toggleClass("active"); 32 $("body").toggleClass("menu-open"); 33 }); 34 } 35 36 /** 37 * Smooth scroll for anchor links 38 */ 39 function initSmoothScroll() { 40 var headerHeight = $(".js-header").outerHeight() || 0; 41 42 if (window.location.hash) { 43 var target = $(window.location.hash); 44 45 if (target.length) { 46 $("html, body").animate( 47 { 48 scrollTop: target.offset().top, 49 }, 50 600, 51 ); 52 } 53 } 54 55 $('a[href*="#"]').on("click", function (e) { 56 var targetId = this.hash; 57 58 if (targetId.length > 1) { 59 var target = $(targetId); 60 61 if (target.length) { 62 e.preventDefault(); 63 64 $("html, body").animate( 65 { 66 scrollTop: target.offset().top, 67 }, 68 600, 69 ); 70 71 // Optional: update URL without jump 72 history.pushState(null, null, targetId); 73 } 74 } 75 }); 76 } 77 78 /** 79 * Lazy load images 80 */ 81 function initLazyLoad() { 82 if ("loading" in HTMLImageElement.prototype) { 83 // Browser supports native lazy loading 84 const images = document.querySelectorAll('img[loading="lazy"]'); 85 images.forEach((img) => { 86 img.src = img.dataset.src || img.src; 87 }); 88 } 89 } 90})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.