| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/v2.hellogtx.com/backup/public/js/ |
Upload File : |
$(document).ready(function()
{
"use strict";
/*
1. Vars and Inits
*/
var menu = $('.menu');
var menuActive = false;
var header = $('.header-scroll');
var searchActive = false;
setHeader();
$(window).on('resize', function()
{
setHeader();
});
$(document).on('scroll', function()
{
setHeader();
});
initHomeSlider();
initMenu();
initSearch();
initCtaSlider();
initTestSlider();
initSearchForm();
/*
2. Set Header
*/
function setHeader()
{
if(window.innerWidth < 992)
{
if($(window).scrollTop() > 100)
{
header.addClass('scrolled');
}
else
{
header.removeClass('scrolled');
}
}
else
{
if($(window).scrollTop() > 100)
{
header.addClass('scrolled');
}
else
{
header.removeClass('scrolled');
}
}
if(window.innerWidth > 991 && menuActive)
{
closeMenu();
}
}
/*
3. Init Home Slider
*/
function initHomeSlider()
{
if($('.home_slider').length)
{
var homeSlider = $('.home_slider');
homeSlider.owlCarousel(
{
items:1,
loop:true,
autoplay:false,
smartSpeed:1200,
dotsContainer:'main_slider_custom_dots'
});
/* Custom nav events */
if($('.home_slider_prev').length)
{
var prev = $('.home_slider_prev');
prev.on('click', function()
{
homeSlider.trigger('prev.owl.carousel');
});
}
if($('.home_slider_next').length)
{
var next = $('.home_slider_next');
next.on('click', function()
{
homeSlider.trigger('next.owl.carousel');
});
}
/* Custom dots events */
if($('.home_slider_custom_dot').length)
{
$('.home_slider_custom_dot').on('click', function()
{
$('.home_slider_custom_dot').removeClass('active');
$(this).addClass('active');
homeSlider.trigger('to.owl.carousel', [$(this).index(), 300]);
});
}
/* Change active class for dots when slide changes by nav or touch */
homeSlider.on('changed.owl.carousel', function(event)
{
$('.home_slider_custom_dot').removeClass('active');
$('.home_slider_custom_dots li').eq(event.page.index).addClass('active');
});
// add animate.css class(es) to the elements to be animated
function setAnimation ( _elem, _InOut )
{
// Store all animationend event name in a string.
// cf animate.css documentation
var animationEndEvent = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
_elem.each ( function ()
{
var $elem = $(this);
var $animationType = 'animated ' + $elem.data( 'animation-' + _InOut );
$elem.addClass($animationType).one(animationEndEvent, function ()
{
$elem.removeClass($animationType); // remove animate.css Class at the end of the animations
});
});
}
// Fired before current slide change
homeSlider.on('change.owl.carousel', function(event)
{
var $currentItem = $('.home_slider_item', homeSlider).eq(event.item.index);
var $elemsToanim = $currentItem.find("[data-animation-out]");
setAnimation ($elemsToanim, 'out');
});
// Fired after current slide has been changed
homeSlider.on('changed.owl.carousel', function(event)
{
var $currentItem = $('.home_slider_item', homeSlider).eq(event.item.index);
var $elemsToanim = $currentItem.find("[data-animation-in]");
setAnimation ($elemsToanim, 'in');
})
}
}
/*
4. Init Menu
*/
function initMenu()
{
if($('.hamburger').length && $('.menu').length)
{
var hamb = $('.hamburger');
var close = $('.menu_close_container');
hamb.on('click', function()
{
if(!menuActive)
{
openMenu();
}
else
{
closeMenu();
}
});
close.on('click', function()
{
if(!menuActive)
{
openMenu();
}
else
{
closeMenu();
}
});
}
}
function openMenu()
{
menu.addClass('active');
menuActive = true;
}
function closeMenu()
{
menu.removeClass('active');
menuActive = false;
}
/*
5. Init Search
*/
function initSearch()
{
if($('.search_tab').length)
{
$('.search_tab').on('click', function()
{
$('.search_tab').removeClass('active');
$(this).addClass('active');
var clickedIndex = $('.search_tab').index(this);
var panels = $('.search_panel');
panels.removeClass('active');
$(panels[clickedIndex]).addClass('active');
});
}
}
/*
6. Init CTA Slider
*/
function initCtaSlider()
{
if($('.cta_slider').length)
{
var ctaSlider = $('.cta_slider');
ctaSlider.owlCarousel(
{
items:1,
loop:true,
autoplay:false,
nav:false,
dots:false,
smartSpeed:1200
});
/* Custom nav events */
if($('.cta_slider_prev').length)
{
var prev = $('.cta_slider_prev');
prev.on('click', function()
{
ctaSlider.trigger('prev.owl.carousel');
});
}
if($('.cta_slider_next').length)
{
var next = $('.cta_slider_next');
next.on('click', function()
{
ctaSlider.trigger('next.owl.carousel');
});
}
}
}
/*
7. Init Testimonials Slider
*/
function initTestSlider()
{
if($('.test_slider').length)
{
var testSlider = $('.test_slider');
testSlider.owlCarousel(
{
loop:true,
nav:false,
dots:false,
smartSpeed:1200,
margin:30,
responsive:
{
0:{items:1},
480:{items:1},
768:{items:2},
992:{items:3}
}
});
/* Custom nav events */
if($('.test_slider_prev').length)
{
var prev = $('.test_slider_prev');
prev.on('click', function()
{
testSlider.trigger('prev.owl.carousel');
});
}
if($('.test_slider_next').length)
{
var next = $('.test_slider_next');
next.on('click', function()
{
testSlider.trigger('next.owl.carousel');
});
}
}
}
/*
8. Init Search Form
*/
function initSearchForm()
{
if($('.search_form').length)
{
var searchForm = $('.search_form');
var searchInput = $('.search_content_input');
var searchButton = $('.content_search');
searchButton.on('click', function(event)
{
event.stopPropagation();
if(!searchActive)
{
searchForm.addClass('active');
searchActive = true;
$(document).one('click', function closeForm(e)
{
if($(e.target).hasClass('search_content_input'))
{
$(document).one('click', closeForm);
}
else
{
searchForm.removeClass('active');
searchActive = false;
}
});
}
else
{
searchForm.removeClass('active');
searchActive = false;
}
});
}
}
});
var Tabs = {
init: function() {
this.bindUIfunctions();
this.pageLoadCorrectTab();
},
bindUIfunctions: function() {
// Delegation
$(document)
.on("click", ".transformer-tabs a[href^='#']:not('.active')", function(event) {
Tabs.changeTab(this.hash);
event.preventDefault();
})
.on("click", ".transformer-tabs a.active", function(event) {
Tabs.toggleMobileMenu(event, this);
event.preventDefault();
});
},
changeTab: function(hash) {
var anchor = $("[href=" + hash + "]");
var div = $(hash);
// activate correct anchor (visually)
anchor.addClass("active").parent().siblings().find("a").removeClass("active");
// activate correct div (visually)
div.addClass("active").siblings().removeClass("active");
// update URL, no history addition
// You'd have this active in a real situation, but it causes issues in an <iframe> (like here on CodePen) in Firefox. So commenting out.
// window.history.replaceState("", "", hash);
// Close menu, in case mobile
anchor.closest("ul").removeClass("open");
},
// If the page has a hash on load, go to that tab
pageLoadCorrectTab: function() {
this.changeTab(document.location.hash);
},
toggleMobileMenu: function(event, el) {
$(el).closest("ul").toggleClass("open");
}
}
Tabs.init();