| Server IP : 104.26.2.156 / Your IP : 216.73.216.185 Web Server : nginx/1.27.1 System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 User : vinodai ( 3134) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v1396/askfalguni/public_html/wp-content/themes/askfalguni/js/ |
Upload File : |
/**
* AskFalguni Theme — Hover State Handler
* Reads data-hover="prop:val;prop2:val2" and applies on mouseenter.
* This powers all hover states from the design (buttons, cards, links, nav).
*/
(function () {
'use strict';
function applyHover(root) {
(root || document).querySelectorAll('[data-hover]').forEach(function (el) {
if (el._afHoverInit) return;
el._afHoverInit = true;
var hoverStyles = {}, origStyles = {};
(el.getAttribute('data-hover') || '').split(';').forEach(function (rule) {
var i = rule.indexOf(':');
if (i > 0) {
var prop = rule.slice(0, i).trim();
var val = rule.slice(i + 1).trim();
if (prop && val) hoverStyles[prop] = val;
}
});
el.addEventListener('mouseenter', function () {
Object.keys(hoverStyles).forEach(function (prop) {
origStyles[prop] = el.style.getPropertyValue(prop);
el.style.setProperty(prop, hoverStyles[prop]);
});
});
el.addEventListener('mouseleave', function () {
Object.keys(hoverStyles).forEach(function (prop) {
el.style.setProperty(prop, origStyles[prop] || '');
});
});
});
}
// Initial run
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () { applyHover(document); });
} else {
applyHover(document);
}
// Re-run on full load (catches late-rendered Elementor widgets)
window.addEventListener('load', function () { applyHover(document); });
// Elementor frontend hook (Elementor Pro dynamic rendering)
window.addEventListener('load', function () {
if (window.elementorFrontend && window.elementorFrontend.hooks) {
window.elementorFrontend.hooks.addAction('frontend/element_ready/html.default', function ($scope) {
applyHover($scope && $scope[0] ? $scope[0] : document);
});
}
});
})();