1/** 2 * Multi Color Text - Mouse Follow Effect (Style 3) 3 */ 4 5(function() { 6 'use strict'; 7 8 function initMouseFollow() { 9 var elements = document.querySelectorAll('.wml-mc-mouse-follow'); 10 11 elements.forEach(function(el) { 12 if (el.dataset.wmlMcInit === 'true') return; 13 el.dataset.wmlMcInit = 'true'; 14 15 var wrapper = el.closest('.wml-mc-wrapper'); 16 if (!wrapper) return; 17 18 el.addEventListener('mousemove', function(evt) { 19 var x = evt.offsetX; 20 var y = evt.offsetY; 21 22 wrapper.style.setProperty('--wml-mc-x', x + 'px'); 23 wrapper.style.setProperty('--wml-mc-y', y + 'px'); 24 }); 25 26 // Reset position when mouse leaves 27 el.addEventListener('mouseleave', function() { 28 wrapper.style.setProperty('--wml-mc-x', '50%'); 29 wrapper.style.setProperty('--wml-mc-y', '50%'); 30 }); 31 }); 32 } 33 34 // Init on DOM ready 35 if (document.readyState === 'loading') { 36 document.addEventListener('DOMContentLoaded', initMouseFollow); 37 } else { 38 initMouseFollow(); 39 } 40 41 // Also init on window load 42 window.addEventListener('load', initMouseFollow); 43 44})();
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.