jQuery(function ($) {
$('.show-more-colors').on('click', function (e) {
e.preventDefault()
var $parent = $(this).closest('.product-gallery-colors')
var $productColors = $parent.find(
'.product-colors .elementor-image-gallery .gallery'
)
var isActive = $productColors.hasClass('active')
if (isActive) {
$productColors.animate({ maxHeight: '128px' }, 300)
$productColors.removeClass('active')
} else {
var scrollHeight = $productColors[0].scrollHeight
$productColors.animate({ maxHeight: scrollHeight + 'px' }, 300)
$productColors.addClass('active')
}
})
})
jQuery(function ($) {
$('.show-more-drafts').on('click', function (e) {
e.preventDefault()
var parent = $(this).closest('.product-gallery-drafts')
var productColors = parent.find(
'.product-drafts .elementor-image-gallery .gallery'
)
var isActive = productColors.hasClass('active')
if (isActive) {
productColors.animate({ maxHeight: '210px' }, 300)
productColors.removeClass('active')
} else {
var scrollHeight = productColors[0].scrollHeight
productColors.animate({ maxHeight: scrollHeight + 'px' }, 300)
productColors.addClass('active')
}
})
})
jQuery(function ($) {
$('.show-more-tabs').on('click', function (e) {
e.preventDefault()
var tabsList = $(this).siblings('ul')
var isActive = tabsList.hasClass('active')
if (isActive) {
tabsList.animate({ maxHeight: '140px' }, 300)
tabsList.removeClass('active')
} else {
var scrollHeight = tabsList[0].scrollHeight
tabsList.animate({ maxHeight: scrollHeight + 'px' }, 300)
tabsList.addClass('active')
}
})
})
jQuery(function ($) {
$('.show-more-gallery').on('click', function (e) {
e.preventDefault()
var parent = $(this).closest('.product-gallery-drafts')
console.log(parent)
var productColors = parent.find(
'.product-drafts .elementor-image-gallery .gallery'
)
var isActive = productColors.hasClass('active')
if (isActive) {
productColors.animate({ maxHeight: '1030px' }, 300)
productColors.removeClass('active')
} else {
var scrollHeight = productColors[0].scrollHeight
productColors.animate({ maxHeight: scrollHeight + 'px' }, 300)
productColors.addClass('active')
}
})
})
jQuery(function ($) {
if ($('#contact-form').length) {
let selects = $('#contact-form select')
selects.each(function () {
$('option:first', this).attr('disabled', 'disabled')
})
}
})
jQuery(function ($) {
$('#contact-form select').each(function () {
var $this = $(this),
numberOfOptions = $(this).children('option').length,
defaultOptionText =
$this.attr('data-placeholder') || $this.children('option').eq(0).text() // Отримуємо текст placeholder або використовуємо перший елемент за замовчуванням
$this.addClass('select-hidden')
$this.wrap('
')
$this.after(
'' + defaultOptionText + '
'
)
var $styledSelect = $this.next('div.select-custom-text')
var $list = $('', {
class: 'select-custom-options',
}).insertAfter($styledSelect)
for (var i = 1; i < numberOfOptions; i++) {
$('', {
text: $this.children('option').eq(i).text(),
rel: $this.children('option').eq(i).val(),
}).appendTo($list)
}
var $listItems = $list.children('li')
$styledSelect.click(function (e) {
e.stopPropagation()
$('div.select-custom-text.active')
.not(this)
.each(function () {
$(this)
.removeClass('active')
.next('ul.select-custom-options')
.slideUp()
})
$(this)
.toggleClass('active')
.next('ul.select-custom-options')
.slideToggle()
})
$listItems.click(function (e) {
e.stopPropagation()
$styledSelect.text($(this).text()).removeClass('active')
$styledSelect.text($(this).text()).addClass('selected')
$this.val($(this).attr('rel'))
$list.slideUp()
})
$(document).click(function () {
$styledSelect.removeClass('active')
$list.slideUp()
})
$list.hide()
})
})
jQuery(function ($) {
$('#hp-acc-more-box').slideUp()
$('#hp-acc-more-btn').on('click', function (e) {
e.preventDefault()
$('#hp-acc-more-box').slideToggle()
})
})
jQuery(function ($) {
var hash = window.location.hash
if (hash) {
var hashValue = hash.substring(1).toLowerCase()
var tabItem = $(
`.eael-tabs-filter-types ul li input[filter="${hashValue}"]`
)
tabItem.trigger('click')
var visibleItems = $(".eael-tabs-nav ul li:not([style*='display: none;'])")
if (visibleItems.length > 0) {
var firstVisibleItem = visibleItems.first()[0]
setTimeout(function () {
console.log(firstVisibleItem)
firstVisibleItem.click()
}, 500)
}
}
})
jQuery(document).ready(function ($) {
$('a[phone]').on('click', function (e) {
e.preventDefault()
var $this = $(this)
var phone = $this.attr('phone')
$.ajax({
url: '/query-contacts.php',
type: 'GET',
data: { phone: phone },
success: function (response) {
if (response.phone) {
var value = response.phone
$this.attr('href', 'tel:' + value)
$this.find('span.elementor-icon-list-text').text(value)
} else {
console.log('Phone number not found in the response.')
}
},
error: function () {
console.log('Error with the AJAX request.')
},
})
})
})
jQuery(function ($) {
const topHeader = $('#top-header-box')
const centerHeader = $('#center-header-box')
const topHeaderOffset = topHeader.offset()
const topHeaderHeight = topHeader.outerHeight()
$(window).scroll(function () {
const currentScrollPosition = $(window).scrollTop()
if (currentScrollPosition > topHeaderOffset.top + topHeaderHeight) {
topHeader.addClass('fixed')
centerHeader.css('padding-top', topHeaderHeight)
} else {
topHeader.removeClass('fixed')
centerHeader.css('padding-top', 0)
}
})
})
jQuery(function ($) {
if ($('#scroller-rows').length) {
var scrollerRows = $('#scroller-rows')
var scrollerRowsHeight = -10
scrollerRows.find('.scroller-row').each(function () {
if ($(this).index() < 2) {
scrollerRowsHeight += $(this).height()
}
})
scrollerRows.css('height', scrollerRowsHeight)
}
})
jQuery(function ($) {
$(document).on('click', '.elementor-menu-toggle', function (e) {
if ($(this).hasClass('elementor-active')) {
$('header').addClass('active')
$dropdown_right =
$('.elementor-menu-toggle').offset().left -
$(window).width() +
$(this).outerWidth()
$('.elementor-nav-menu--dropdown').css({
right: $dropdown_right,
})
} else {
$('header').removeClass('active')
'.elementor-nav-menu--dropdown'.css({
right: 0,
})
}
})
})