Files

327 lines
12 KiB
Plaintext
Raw Permalink Normal View History

2025-11-17 17:32:21 +01:00
(function ($) {
"use strict";
var $window = $(window),
$body = $('body'),
isRtl = $body.hasClass('rtl');
/*-----------------------------------------------------------------------------------*/
/* Flex Slider
/* You can learn more about its options from http://www.woothemes.com/flexslider/
/*-----------------------------------------------------------------------------------*/
if (jQuery().flexslider) {
// Flex Slider for gallery detail page
$('#carousel').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
reverse: false,
slideshow: false,
itemWidth: 123,
minItems: 4,
itemMargin: 10,
asNavFor: '#slider'
});
$('#slider').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
sync: "#carousel"
});
// Flex Slider Three for home testimonial section
$('.flexslider-three').flexslider({
animation: "fade",
controlNav: false,
directionNav: true,
pauseOnHover: true,
pauseOnAction: false,
smoothHeight: true
});
// Flex Slider for services single
$('.services-single .flexslider').flexslider({
animation: "fade",
controlNav: true,
directionNav: false,
pauseOnHover: true,
pauseOnAction: false,
smoothHeight: true
});
}
/*-----------------------------------------------------------------*/
/* Select2 - https://select2.github.io/
/*-----------------------------------------------------------------*/
$(window).on("load", function () {
$('.woocommerce-ordering .orderby, .woocommerce .variations select, #calc_shipping_country, #product_cat').select2();
});
/*-----------------------------------------------------------------*/
/* Isotopes Effects
/*-----------------------------------------------------------------*/
if (jQuery().isotope) {
var $isotopeContainer = $('#isotope-container');
$window.on('load', function () {
$isotopeContainer.isotope({
itemSelector: '.isotope-item',
layoutMode: 'fitRows'
});
});
$('#filters').not('.no-isotope').on('click', 'a', function (event) {
event.preventDefault();
var $this = $(this),
filterValue = $this.attr('data-filter');
$(this).parents('li').addClass('active').siblings().removeClass('active');
$isotopeContainer.isotope({
filter: filterValue
});
});
}
/*-----------------------------------------------------------------*/
/* For FAQ Groups Filtering
/*-----------------------------------------------------------------*/
var singleItem = $('#filters a.no-isotope'),
faqsWrapper = $('.toggle-main.faq'),
$questions = $('.toggle-main.faq').find('.toggle');
$(this).parents('li').addClass('active').siblings().removeClass('active');
singleItem.on( 'click', function (e) {
e.preventDefault();
var selector = $(this).attr('data-filter');
faqsWrapper.animate({opacity: 0}, 300, function(){
if (selector == '*') {
$questions.show();
} else {
$questions.not(selector).hide().end().filter(selector).show();
}
faqsWrapper.animate({opacity: 1});
});
});
/*----------------------------------------------------*/
/* Tabs for tab widget
/*----------------------------------------------------*/
$('.tabs .tabs-content').first().css('display', 'block');
$(".tabs .tab-head").on( 'click', function () {
$(this).siblings().removeClass("active").end().andSelf().addClass("active");
var tab = $(this).index();
var content = $('.tabs-content');
content.stop(true, true).hide().velocity({opacity: 0}, 500);
$('.tabs-content:eq(' + tab + ')').stop(true, true).show().velocity({opacity: 1}, 500);
});
/*-----------------------------------------------------------------------------------*/
/* Tabs
/*-----------------------------------------------------------------------------------*/
$(function () {
var $tabsNav = $('.tabs-nav'),
$tabsNavLis = $tabsNav.children('li');
$tabsNav.each(function () {
var $this = $(this);
$this.next().children('.tab-content').stop(true, true).hide()
.first().show();
$this.children('li').first().addClass('active').stop(true, true).show();
});
$tabsNavLis.on('click', function (e) {
var $this = $(this);
if (!$this.hasClass('active')) {
$this.siblings().removeClass('active').end()
.addClass('active');
var idx = $this.parent().children().index($this);
$this.parent().next().children('.tab-content').stop(true, true).hide().eq(idx).fadeIn();
}
e.preventDefault();
});
});
/*-----------------------------------------------------------------*/
/* Toggle
/*-----------------------------------------------------------------*/
$('.toggle-main .toggle:first-child').addClass('current')
.find('i.fa').removeClass('fa-plus').addClass('fa-minus').end()
.children('.toggle-content').css('display', 'block');
$('.toggle-title').on('click', function () {
var parent_toggle = $(this).closest('.toggle');
if (parent_toggle.hasClass('current')) {
$(this).find('i.fa').removeClass('fa-minus').addClass('fa-plus');
parent_toggle.removeClass('current').children('.toggle-content').slideUp(300);
} else {
$(this).find('i.fa').removeClass('fa-plus').addClass('fa-minus');
parent_toggle.addClass('current').children('.toggle-content').slideDown(300);
}
});
/*-----------------------------------------------------------------*/
/* Accordion
/*-----------------------------------------------------------------*/
$('.accordion-main .accordion:first-child').addClass('current')
.children('.accordion-content').css('display', 'block').end()
.find('i.fa').removeClass('fa-plus').addClass('fa-minus');
$('.accordion-title').on('click', function () {
var parent_accordion = $(this).closest('.accordion');
if (parent_accordion.hasClass('current')) {
$(this).find('i.fa').removeClass('fa-minus').addClass('fa-plus');
parent_accordion.removeClass('current').children('.accordion-content').slideUp(300);
} else {
$(this).find('i.fa').removeClass('fa-plus').addClass('fa-minus');
parent_accordion.addClass('current').children('.accordion-content').slideDown(300);
}
var siblings = parent_accordion.siblings('.accordion');
siblings.find('i.fa').removeClass('fa-minus').addClass('fa-plus');
siblings.removeClass('current').children('.accordion-content').slideUp(300);
});
/*-----------------------------------------------------------------------------------*/
/* Scroll to Top
/*-----------------------------------------------------------------------------------*/
$(function () {
$(window).on( 'scroll', function () {
if (!$('body').hasClass('probably-mobile')) {
if ($(this).scrollTop() > 250) {
$('a#scroll-top').fadeIn();
} else {
$('a#scroll-top').fadeOut();
}
}
else {
$('a#scroll-top').fadeOut();
}
});
$('a#scroll-top').on('click', function (event) {
event.preventDefault();
$('html, body').velocity("scroll", {duration: 750, easing: "swing"});
});
});
/*-----------------------------------------------------------------*/
/* Swipe Box
/*-----------------------------------------------------------------*/
if ($().swipebox) {
// Initialize the Lightbox automatically for any links to images with extensions .jpg, .jpeg, .png or .gif
$('.clone .swipebox').removeClass('swipebox');
$( '.swipebox' ).swipebox( { useSVG : false, loopAtEnd: true });
}
/*-----------------------------------------------------------------*/
/* Date Picker
/*-----------------------------------------------------------------*/
if (jQuery().datepicker) {
$("#datepicker").datepicker();
$("#appointment-modal-form-datepicker").datepicker({ minDate: 0 });
}
/*-----------------------------------------------------------------*/
/* Message
/*-----------------------------------------------------------------*/
$('.message .close').on('click', function (e) {
$(this).closest('.message').slideUp(300);
});
/*-----------------------------------------------------------------*/
/* Animations Effects
/*-----------------------------------------------------------------*/
$('.animated').appear();
$(document.body).on('appear', '.fade', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fade');
});
});
$(document.body).on('appear', '.slide-animate', function () {
$(this).each(function () {
$(this).addClass('ae-animation-slide-animate');
});
});
$(document.body).on('appear', '.hatch', function () {
$(this).each(function () {
$(this).addClass('ae-animation-hatch');
});
});
$(document.body).on('appear', '.entrance', function () {
$(this).each(function () {
$(this).addClass('ae-animation-entrance');
});
});
$(document.body).on('appear', '.tada', function () {
$(this).each(function () {
$(this).addClass('ae-animation-tada');
});
});
$(document.body).on('appear', '.rotate-up', function () {
$(this).each(function () {
$(this).addClass('ae-animation-rotate-up');
});
});
$(document.body).on('appear', '.rotate-down', function () {
$(this).each(function () {
$(this).addClass('ae-animation-rotate-down');
});
});
$(document.body).on('appear', '.fadeInDown', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInDown');
});
});
$(document.body).on('appear', '.fadeInUp', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInUp');
});
});
$(document.body).on('appear', '.fadeInLeft', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInLeft');
});
});
$(document.body).on('appear', '.fadeInRight', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInRight');
});
});
$(document.body).on('appear', '.fadeInDownBig', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInDownBig');
});
});
$(document.body).on('appear', '.fadeInUpBig', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInUpBig');
});
});
$(document.body).on('appear', '.fadeInLeftBig', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInLeftBig');
});
});
$(document.body).on('appear', '.fadeInRightBig', function () {
$(this).each(function () {
$(this).addClass('ae-animation-fadeInRightBig');
});
});
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
// Yep, it's Safari =)
$('body').addClass('safari');
}
})(jQuery);