Files
wingedit.pl/wp-content/themes/restly-child/assets/js/custom.js
Roman Pyrih 87667291e5 Save
2024-11-12 12:13:27 +01:00

80 lines
2.2 KiB
JavaScript

jQuery(function($) {
$(".header-email-handler").on("click", function() {
getEmail(function(response) {
$(".header-email-handler").html(response);
});
});
$("#footer-email").on("click", function() {
getEmail(function(response) {
$("#footer-email").html(response);
});
});
$("#contact-email").on("click", function() {
getEmail(function(response) {
$("#contact-email").html(response);
});
});
$(".big-form-email").on("click", function() {
getEmail(function(response) {
$(".big-form-email").html(response);
});
});
function getEmail(callback) {
$.ajax({
url: "/secret-email.php",
type: "GET",
dataType: "json",
success: function(response) {
callback(response)
},
error: function(xhr, status, error) {
console.error(error);
}
});
}
})
jQuery(function($) {
$(window).scroll(function() {
if ($(this).scrollTop() >= 100) {
$('header#masthead').addClass('fixed');
} else {
$('header#masthead').removeClass('fixed');
}
});
});
jQuery(document).ready(function ($) {
$('.elementor-tab-title').on('click', function (e) {
e.preventDefault();
const $clickedTitle = $(this);
const tabId = $clickedTitle.data('tab');
const $content = $('.elementor-tab-content[data-tab="' + tabId + '"]');
$('.elementor-tab-content')
.not($content)
.slideUp(300)
.prev('.elementor-tab-title')
.attr('aria-expanded', 'false')
.find('.elementor-accordion-icon-opened').hide()
.siblings('.elementor-accordion-icon-closed').show();
if ($clickedTitle.attr('aria-expanded') === 'true') {
$clickedTitle.attr('aria-expanded', 'false');
$content.slideUp(300);
$clickedTitle.find('.elementor-accordion-icon-opened').hide();
$clickedTitle.find('.elementor-accordion-icon-closed').show();
} else {
$clickedTitle.attr('aria-expanded', 'true');
$content.slideDown(300);
$clickedTitle.find('.elementor-accordion-icon-closed').hide();
$clickedTitle.find('.elementor-accordion-icon-opened').show();
}
});
});