| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/plugins/eltd-core/shortcodes/button/assets/js/ |
Upload File : |
(function($) {
'use strict';
var button = {};
eltd.modules.button = button;
button.eltdButton = eltdButton;
button.eltdOnDocumentReady = eltdOnDocumentReady;
$(document).ready(eltdOnDocumentReady);
/*
All functions to be called on $(document).ready() should be in this function
*/
function eltdOnDocumentReady() {
eltdButton().init();
}
/**
* Button object that initializes whole button functionality
* @type {Function}
*/
var eltdButton = function() {
//all buttons on the page
var buttons = $('.eltd-btn');
/**
* Initializes button hover color
* @param button current button
*/
var buttonHoverColor = function(button) {
if(typeof button.data('hover-color') !== 'undefined') {
var changeButtonColor = function(event) {
event.data.button.css('color', event.data.color);
};
var originalColor = button.css('color');
var hoverColor = button.data('hover-color');
button.on('mouseenter', { button: button, color: hoverColor }, changeButtonColor);
button.on('mouseleave', { button: button, color: originalColor }, changeButtonColor);
}
};
/**
* Initializes button hover background color
* @param button current button
*/
var buttonHoverBgColor = function(button) {
if(typeof button.data('hover-bg-color') !== 'undefined') {
var changeButtonBg = function(event) {
event.data.button.css('background-color', event.data.color);
};
var originalBgColor = button.css('background-color');
var hoverBgColor = button.data('hover-bg-color');
button.on('mouseenter', { button: button, color: hoverBgColor }, changeButtonBg);
button.on('mouseleave', { button: button, color: originalBgColor }, changeButtonBg);
}
};
/**
* Initializes button border color
* @param button
*/
var buttonHoverBorderColor = function(button) {
if(typeof button.data('hover-border-color') !== 'undefined') {
var changeBorderColor = function(event) {
event.data.button.css('border-color', event.data.color);
};
var originalBorderColor = button.css('borderTopColor'); //take one of the four sides
var hoverBorderColor = button.data('hover-border-color');
button.on('mouseenter', { button: button, color: hoverBorderColor }, changeBorderColor);
button.on('mouseleave', { button: button, color: originalBorderColor }, changeBorderColor);
}
};
return {
init: function() {
if(buttons.length) {
buttons.each(function() {
buttonHoverColor($(this));
buttonHoverBgColor($(this));
buttonHoverBorderColor($(this));
});
}
}
};
};
})(jQuery);