').insertAfter("#navigation div.logo");
// Show/Hide mobile navigation
$('.mobile-nb').on("click", function(){
setTimeout( function(){ $('#mobile-navigation').addClass("active");}, 300);
$('#mobile-navigation-closer').fadeIn();
});
// Create mobile navigation and get elements
$('
').insertAfter('#navigation');
var $navMenus = $('#navigation .nav-menu, #punch-navigation').html(),
$navEl = $('#navigation .nav-elements').html(),
$navTop = $('#pagetop').html();
//Get navigation menus
$($navMenus).insertBefore('#mobile-navigation .nav-el');
//Get navigation elements - search button select language .etc
$('#mobile-navigation .nav-el').append($navEl);
//Get Pagetop
if ($('#pagetop').exists()) {$('#mobile-navigation .pagetop').append($navTop);}
//Move the search button
if ($('#mobile-navigation .search-form-trigger').exists()) { $('#mobile-navigation .search-form-trigger').appendTo('#mobile-navigation .nav-el'); }
//Move search form to mobile navigation from sidemenu
if ($('#navigation.side-menu .search').exists()) {
$('#mobile-navigation .nav-el').append('');
}
if ($('#navigation.side-menu .menu-bottom').exists()) {
var mBottom = $('#navigation.side-menu .menu-bottom').html();
$('#mobile-navigation .pagetop').append(mBottom);
}
var $desktopLogo = $('#navigation .logo img').attr('src');
$.fn.changeMobileLogo = function() {
if ($(window).width() < 1120) {
var $mobileLogo = $('#navigation .logo img').attr('data-mobile-logo');
if (typeof $mobileLogo !== typeof undefined && $mobileLogo !== false) {$("#navigation .logo img").attr("src", $mobileLogo);}
} else{ $("#navigation .logo img").attr("src", $desktopLogo); }
}
$(window).changeMobileLogo();
//Close Mobile Navigation
$('').insertAfter("#mobile-navigation");
$('#mobile-navigation-closer, .search-form-trigger, .mb-close').on("click", function(){
$('#mobile-navigation').removeClass("active");
setTimeout( function(){$('#mobile-navigation-closer').fadeOut();},300);
});
//Make Dropdown for mobile
$('#mobile-navigation li.dropdown-toggle > a').append('');
$("#mobile-navigation .dropdown-toggle>a").not('.cart-item').on( "click touch", function() {
$(this).toggleClass('showing').closest('li').find('> ul.dropdown-menu').slideToggle({duration: 300, easing: "easeInOutQuart"});
return false;
});
//Pagetop collaboration with navigation
if ($(window).width() > 1120) {
$('#pagetop').each(function(){
var itemH = $(this).outerHeight(),
bigNav = $('#navigation.modern').not('.sticky, .static');
bigNav.addClass('pagetopped').css("margin-top", itemH + 'px');
});
}
//See links inside the page for smooth scroll
$( "a[href^='#']:not([href='#']):not(.no-scroll):not([data-slide]):not([data-toggle])" ).on('click touch', function(event) {
var $anchor = $(this), headerOffset = $('#navigation').data("offset"), $target = $($anchor).attr('href');
event.preventDefault();
if($($target).length){
if($('#navigation').length){
$('html, body').stop().animate({
scrollTop : $($anchor.attr('href')).offset().top - headerOffset + "px"
}, 1150, 'easeInOutExpo');
} else{
$('html, body').stop().animate({ scrollTop : $($anchor.attr('href')).offset().top }, 900, 'easeInOutExpo');
}
}
});
//Back to top
$( "a[href='#top']" ).on('click', function() {
$('html, body').stop().animate({ scrollTop : 0 }, 1400, 'easeInOutExpo');
});
//Hide with scroll down - Back to top button - hide-on-home elements
if ( $('.hide-by-scroll').exists() || $('#back-to-top').exists() || $('.hide-on-home').exists()){
// hide #back-to-top first
$("#back-to-top, .hide-on-home").hide();
// show hide subnav depending on scroll direction
var position = $(window).scrollTop();
$(window).on("scroll touchmove", function () {
var scroll = $(window).scrollTop();
if (scroll > position - 1 && scroll > 700) {
$('.hide-by-scroll').addClass('hiding');
} else {
$('.hide-by-scroll').removeClass('hiding');
}
position = scroll;
if($(window).scrollTop() + $(window).height() === $(document).height()) {
$('.hide-by-scroll').removeClass('hiding');
}
// fade in #back-top
// You can add .hide-on-home class to any fixed item. It will be unvisible on home and visible when you scroll down.
if ($(this).scrollTop() > 500) { $('#back-to-top, .hide-on-home').fadeIn(); } else { $('#back-to-top, .hide-on-home').fadeOut(); }
});
}
$('.hide-by-click').on('click', function(){$(this).fadeOut('slow');});
//*********************************************
// Side Dotted Navigation
//*********************************************
// Add/Remove class with hover
if ($('#side-dotted-navigation').exists()){
var self = $('#side-dotted-navigation');
$(self).on('mouseenter',function(){$(this).removeClass('spy');})
$(self).on('mouseleave',function(){$(this).addClass('spy');})
$(self).on('click touch touchstart', function(){ event = event || window.event; event.stopPropagation();});
}
//*********************************************
// Punch Navigation Scripts
//*********************************************
//Show Punch navigation
$.fn.showPunchNavigation = function() {
// Calculate Vertical Center
$('#punch-navigation').addClass('activated');
$('#punch-navigation .shadow').fadeIn(300);
$('body').addClass('o-hidden');
$('.top-elements, .bottom-elements, div.navblock *').delay(950).fadeIn(300);
$('body').calculateWidth();
};
//Hiding navigation scripts
$.fn.hidePunchNavigation = function() {
$('.top-elements, .bottom-elements, div.navblock>*').fadeOut(300);
$('#punch-navigation .shadow').delay(1000).fadeOut(300);
setTimeout( function(){ $('#punch-navigation').addClass('closing'); $('body').removeClass('o-hidden'); $('body').calculateWidth(); }, 100);
setTimeout( function(){ $('#punch-navigation').removeClass('closing activated');}, 1400);
};
//Call punch nav with ".punch-navigation-trigger" class. You can show it with a lot of buttons in the page.
$('.punch-navigation-trigger').on('click', function(){
if(!$('#punch-navigation').hasClass('activated')){ $('body').showPunchNavigation();}
else{ $('body').hidePunchNavigation(); }
//Trigger mobile nav
if ($(window).width() < 1120) {
setTimeout( function(){ $('#mobile-navigation').animate({left: '0px'}, 400, 'easeOutSine');}, 300);
$('#mobile-navigation-closer').fadeIn();
}
});
//Close the Punch navigation with press ESC.
$(document).keyup(function(e) {if (e.keyCode === 27) { if ($('#punch-navigation').hasClass('activated')) { $('body').hidePunchNavigation(); } } });
//Close the Punch navigation before change the page.
$('#punch-navigation .navblock a').not('.nav-title, .nav-subtitle').on('click', function(){
var Exlink = this.getAttribute('href');
// Close the navigation
$('body').hidePunchNavigation();
setTimeout( function(){ document.location.href = Exlink;}, 1500);
return false;
});
$('#punch-navigation a.nav-title').on('click', function(){ return false; });
//End punch navigation scripts
//Search Form Fullscreen
if ($('.fs-searchform').exists()){
var trigger = $('.search-form-trigger'),
form = $('.fs-searchform');
$(trigger).on('click touch', function(event){
$(form).addClass('active');
setTimeout( function(){$('.fs-searchform input').focus();},900);
return false;
});
$('.form-bg').on('click', function(){
$('.fs-searchform').removeClass('active');
});
//Close the form with press ESC.
$(document).keyup(function(e) {if (e.keyCode === 27) {$('.fs-searchform').removeClass('active');} });
$('.fs-searchform a').on('click', function(){
var Exlink = this.getAttribute('href');
// Close the navigation
$('.fs-searchform').removeClass('active');
setTimeout( function(){ document.location.href = Exlink;},500);
return false;
});
}
//*********************************************
// CONTACT FORM VALIDATE SCRITPS
//*********************************************
//Contact Form Settings
var rnuma = Math.floor(Math.random() * 5);
var rnumb = Math.floor(Math.random() * 5);
var sum = rnuma + rnumb;
$("#math").html(sum); $("#verify").attr("placeholder", rnuma + "+" + rnumb + "= ?");
var validator = $('#contact_form, .quick_form, #newsletter_form');
// Validate Contact Form
$(validator).each(function(){
var sendBtn = $(this).find(':submit'),
$this = $(this),
timer = window.setTimeout(3500);
// Classic Quadra Validate
$(this).validate({
ignore: ".ignore",
rules: {
verify: { equalTo: "#math" },
hiddenRecaptcha: {
required: function () {
if (grecaptcha.getResponse() === '') {
$('.g-recaptcha').addClass('error_warning');
return true;
} else {
$('.g-recaptcha').removeClass('error_warning');
return false;
}
}
}
},
onfocusout: false,
showErrors: function(map, list) {
this.currentElements.removeClass("error_warning");
this.currentElements.closest('.border-effect').removeClass('error_warning');
$.each(list, function(index, error) {
window.clearTimeout(timer);
$(error.element).addClass("error_warning");
$(error.element).closest('.border-effect').addClass('error_warning');
$("div#error_message").fadeIn(300).clearQueue();
$("div#error_message").on("click", function(){$(this).fadeOut("fast"); window.clearTimeout(timer);});
timer = window.setTimeout( function(){ $("div#error_message").fadeOut("fast");}, 3500);
});
},
submitHandler: function(form) {
$(sendBtn).not('.loading').addClass('loading').append( "" );
$.ajax({
url: form.action,
type: form.method,
data: new FormData($(form)[0]),
cache: false,
contentType: false,
processData: false,
success : function() {
$("div#error_message").fadeOut("fast");
$("div#submit_message").fadeIn("fast");
$(validator).find(".inputfile + label span").empty();
setTimeout( function(){ $("div#submit_message").fadeOut("fast"); }, 5000);
$(sendBtn).removeClass('loading');
$(validator).trigger("reset");
}
});
}
});
});
//*********************************************
// SUBSCRIBE FORMS
//*********************************************
// Subscribe Forms
var $newsletterForm = $('form#newsletter_form'), sendBtn = $($newsletterForm).find('button');
$($newsletterForm).validate({
showErrors: function() {
this.currentElements.removeClass("error_warning");
this.currentElements.closest('.border-effect').removeClass('error_warning');
},
submitHandler: function() {
$(sendBtn).not('.loading').addClass('loading').append( "" );
$.ajax({
url: $newsletterForm.action,
type: $newsletterForm.method,
data: $newsletterForm.serialize(),
cache: false,
contentType: "application/json; charset=utf-8",
dataType : 'json',
success : function() {
$("div#error_message").removeClass("active");
$("div#submit_message").addClass("active");
setTimeout( function(){ $("div#submit_message").removeClass("active"); }, 5000);
$(sendBtn).removeClass('loading');
$($newsletterForm).trigger("reset");
}
});
}
});
// Alerts with clicks
$('.qdr-alert-trigger').each(function(){
var self = $(this),
target = $(self).data('target'),
timer;
$(self).on('click', function(){
clearTimeout(timer);
$(target).fadeOut(0).stop().clearQueue();
setTimeout( function(){$(target).fadeIn(300)},1);
timer = setTimeout( function(){$(target).fadeOut(300);},3000);
});
});
//Create border effect toggle for the input and textareas
jQuery('span.border-effect').each(function(){
var $this = $(this);
$($this).find('*').on('blur', function(){ $($this).removeClass('active'); }).on('focus', function (){ $($this).addClass('active');});
});
//*********************************************
// LIGHTBOXES
//*********************************************
//Lightbox Gallery Class for containers. All "a" links will work for lightbox with click.
//Also you can add .no-lightbox claass for no-lightbox links.
$.fn.callLightboxGallery = function() {
$('.lightbox_gallery').lightGallery({
selector: 'a:not(.no-lightbox)',
download: true,
speed: 400,
loop: true,
controls: true,
thumbWidth: 100,
thumbContHeight: 100,
thumbMargin: 8,
share: true,
cssEasing: 'cubic-bezier(0.645, 0.045, 0.355, 1)',
loadYoutubeThumbnail: true,
youtubeThumbSize: 'default',
iframeMaxWidth: '75%',
loadVimeoThumbnail: true,
vimeoThumbSize: 'thumbnail_medium',
youtubePlayerParams: { modestbranding: 1, showinfo: 0, rel: 0, controls: 0 },
vimeoPlayerParams: { byline : 0, portrait : 0, color : 'A90707' }
});
$('.lightbox_gallery:not(.no-lightbox)').addClass('lightboxed');
}
if ($(".lightbox_gallery").exists()) { $(window).callLightboxGallery(); }
//Only .lightbox_selected classes will work in .lightbox_selected container
$.fn.callLightboxSelected = function() {
$('.lightbox_selected').lightGallery({
selector: 'a.lightbox_item',
download: true,
speed: 500,
loop: true,
controls: true,
thumbWidth: 100,
thumbContHeight: 100,
thumbMargin: 8,
share: true,
cssEasing: 'cubic-bezier(0.645, 0.045, 0.355, 1)',
loadYoutubeThumbnail: true,
youtubeThumbSize: 'default',
loadVimeoThumbnail: true,
iframeMaxWidth: '75%',
vimeoThumbSize: 'thumbnail_medium',
youtubePlayerParams: { modestbranding: 1, showinfo: 0, rel: 0, controls: 0 },
vimeoPlayerParams: { byline : 0, portrait : 0, color : 'A90707' }
});
}
if ($(".lightbox_selected").exists()) { $(window).callLightboxSelected(); }
//You can add .lightbox classes to single elements
$.fn.callLightbox = function() {
$('.lightbox').lightGallery({
selector: 'this',
download: true,
thumbWidth: 100,
thumbContHeight: 100,
share: true,
loadYoutubeThumbnail: true,
youtubeThumbSize: 'default',
iframeMaxWidth: '75%',
loadVimeoThumbnail: true,
youtubePlayerParams: { modestbranding: 1, showinfo: 0, rel: 0, controls: 0 },
vimeoPlayerParams: { byline : 0, portrait : 0, color : 'A90707' }
});
}
if ($(".lightbox").exists()) { $(window).callLightbox(); }
//*********************************************
// SLIDERS
//*********************************************
//Slider for twin sections
if ($(".slider-for").exists()) {
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
touchThreshold: 150,
fade: true,
asNavFor: '.slider-nav'
});
}
//Navigation to .slider-for
if ($(".slider-nav").exists()) {
$('.slider-nav').slick({
slidesToShow: 2,
slidesToScroll: 1,
asNavFor: '.slider-for',
touchThreshold: 150,
dots: false,
arrows: false,
centerMode: true,
focusOnSelect: true
});
}
if ($(".news-slider").exists()) {
$(".news-slider").slick({
dots: false,
arrows: true,
infinite: true,
touchThreshold: 150,
fade: true,
slidesToShow: 1,
prevArrow: '',
nextArrow: '',
slidesToScroll: 1
});
}
if ($(".background-slider").exists()) {
$(".background-slider").slick({
dots: false,
arrows: false,
infinite: true,
autoplay: true,
touchThreshold: 150,
fade: true,
slidesToShow: 1,
slidesToScroll: 1
});
$('.slider-next-trigger').on("click", function(){$(".background-slider").slick('slickNext');});
$('.slider-prev-trigger').on("click", function(){$(".background-slider").slick('slickPrev');});
}
//Image slider with dots and arrows - Usable within another slider
if ($(".image-slider").exists()) { $(".image-slider").slick({ dots: true, arrows: true, infinite: true, fade: true, slidesToShow: 1, slidesToScroll: 1, touchThreshold: 20, adaptiveHeight: true }).on('afterChange', function(event, slick){ $('.custom-slider').slick("slickSetOption", "swipe", true); }); }
//Custom slider
if ($(".custom-slider").exists()) {
$('.custom-slider').each(function(){
var $this = $(this);
$($this).slick({
//Default Options
fade: false,
dots: false,
arrows: false,
autoplay: false,
autoplaySpeed: 3000,
pauseOnHover: true,
lazyLoad: 'ondemand',
infinite: true,
rtl: false,
edgeFriction: 0,
easing: 'linear',
touchThreshold: 150,
speed: 400,
slidesToShow: 3,
initialSlide: 0,
draggable: false,
adaptiveHeight: true,
variableWidth: false,
prevArrow: '',
nextArrow: '',
centerMode: false,
slidesToScroll: 1,
setPosition: 1,
swipe: true,
touchMove: true,
responsive: [{
breakpoint: 992,
settings: { slidesToShow: 2, slidesToScroll: 1 }
}, {
breakpoint: 600,
settings: { slidesToShow: 1, slidesToScroll: 1 }
}
]
}).on('afterChange', function(event, slick, currentSlide){
if ($($this).hasClass('hero-slider')) {
var items = $('.hero-slider .animated'),
current = $('.hero-slider .slick-current .animated'),
nCurrent = $('.hero-slider .slick-slide:not(.slick-current) .animated');
Waypoint.refreshAll();
$(current).each(function() {
var item = $(this), animation = item.data('animation'), animationDelay = item.data('animation-delay');
setTimeout(function(){ item.addClass( animation + " visibleme" ); }, animationDelay);
});
$(nCurrent).each(function() {
var item = $(this), animation = item.data('animation');
item.removeClass( animation + "visibleme" );
});
$('.slick-current video').each(function () {this.play();});
$('.slick-slide:not(.slick-current) video').each(function () {this.pause();});
$($this).find('.slick-slide.slick-current .slide-img .scale-timer').addClass("scaling");
}
}).on('beforeChange', function(event, slick, currentSlide, nextSlide){
Waypoint.refreshAll();
$(items).removeClass("visible");
var nCurrent = $('.hero-slider .slick-slide:not(.slick-current) .animated') ,items = $('.hero-slider .animated');
$(nCurrent).each(function() {
var item = $(this), animation = item.data('animation'), animationDelay = item.data('animation-delay');
$(item).removeClass( animation + " visibleme" );
});
if( mobile === false ) {
if (isParallaxBrowsers) {$(window).data('plugin_stellar').refresh(); }
}
$($this).find('.slick-slide:not(slick-current) .slide-img .scale-timer').removeClass("scaling");
});
});
//Block drag the .custom-slider when sliding images.
$('.image-slider, .image-slider-navs, .image-slider-dots').on('touchstart touchmove touchend', function(){ $('.custom-slider').slick("slickSetOption", "swipe", false); });
$('.custom-slider').on('touchstart touchmove touchend', function(){ $('.custom-slider').slick("slickSetOption", "swipe", true);});
$('.slick-slider.calculate-height .slick-track').addClass('calculate-height');
$(window).resize(function(){
$('.slick-slider.calculate-height .slick-track').addClass('calculate-height');
});
}
//Hero slider Ready
if ($(".hero-slider").exists()) {
//Work for window load
$('.hero-slider .slick-slide:not(.slick-current) .animated').removeClass('visible');
$('.slick-slide.slick-current .slide-img .scale-timer').addClass("scaling");
$('.hero-slider .slick-current .animated').each(function() {
var item = $(this), animation = item.data('animation'), animationDelay = item.data('animation-delay');
$(item).removeClass(animation);
setTimeout(function(){ item.addClass( animation + " visibleme" ); }, animationDelay);
});
//Next&Prev with external buttons
$('.hero-slider-next').on("click", function(){ $(".hero-slider").slick('slickNext'); });
$('.hero-slider-prev').on("click", function(){ $(".hero-slider").slick('slickPrev'); });
}
//Navigation to .slider-for
if ($(".nav-to-custom-slider").exists()) {
$('.nav-to-custom-slider').slick({
slidesToShow: 2,
slidesToScroll: 1,
asNavFor: '.custom-slider',
dots: false,
touchThreshold: 50,
arrows: false,
centerMode: false,
focusOnSelect: true
});
}
//Background color changer
if ($('[data-background-color-selector]').exists()){
$('[data-background-color-selector]').each(function() {
var $this = $(this), colorSource = $($this).attr('data-background-color-selector'), colorHome = $('#home').attr('data-background-color-selector');
$this.waypoint(function(direction){ if (direction === 'down') { $('.bg-changeable').css({"background-color": '#' + colorSource}); $('.changeable-border').css({"border-color": '#' + colorSource}); } }, { offset: '60%' });
$this.waypoint(function(direction){ if (direction === 'up') { $('.bg-changeable').css({"background-color": '#' + colorSource}); $('.changeable-border').css({"border-color": '#' + colorSource}); } }, { offset: '-90%' });
$(window).on("scroll", function(){ if( $(window).scrollTop() < 10 ) { $('.bg-changeable').css({"background-color": '#' + colorHome}); $('.changeable-border').css({"border-color": '#' + colorHome}); } });
});
}
//Modal edition for slider
$('.modal').each(function(){
var $this = $(this),
$slider = $(this).find('.slick-slider');
$($this).on('show.bs.modal', function (e) {
setTimeout( function(){ $($slider).addClass('modal-active'); }, 4000);
if ($(window).width() > 992 ) {
setTimeout( function(){$($slider).slick('refresh'); }, 300);
} else{
setTimeout( function(){$($slider).resize(); }, 400);
}
});
$($this).on('hidden.bs.modal', function (e) {
setTimeout( function(){ $($slider).removeClass('modal-active');}, 400);
});
});
//*********************************************
// Refresh parallax effect, lightbox, icon navigation when click portfolio filters
//*********************************************
$('.cbp-l-loadMore-button, [data-toggle]:not([data-toggle="popover"]), .cbp-filter-item, .cbp-l-loadMore-link').on('click', function(){
setTimeout( function(){ if (isParallaxBrowsers && mobile === false) {
$(window).data('plugin_stellar').refresh();
var s = skrollr.init({ forceHeight: false }); s.refresh();
$(".icon-navigation").addClass("slow");
} Waypoint.refreshAll(); }, 500);
setTimeout( function(){$(".icon-navigation").removeClass("slow");}, 1400);
});
function detectWindowHeightChange(elm, callback){
var lastHeight = elm.clientHeight, newHeight;
(function run(){
newHeight = elm.clientHeight;
if( lastHeight != newHeight )
callback();
lastHeight = newHeight;
if( elm.onElementHeightChangeTimer )
clearTimeout(elm.onElementHeightChangeTimer);
elm.onElementHeightChangeTimer = setTimeout(run, 200);
})();
}
detectWindowHeightChange(document.body, function(){
if ($(".cbp-item:last-child").hasClass("cbp-item-loading")) {
if ($(".lightbox_gallery").exists()) { $(".lightbox_gallery").data('lightGallery').destroy(true); $(window).callLightboxGallery(); }
if ($(".lightbox_selected").exists()) { $(".lightbox_selected").data('lightGallery').destroy(true); $(window).callLightboxSelected(); }
if ($(".lightbox").exists()) { $(".lightbox").data('lightGallery').destroy(true); $(window).callLightbox(); }
}
});
//*********************************************
// VIDEO COMPATIBILITY ON SLICK SLIDER
//*********************************************
//Slick slider video option
$(".slick-slider").on('beforeChange', function(event, slick, currentSlide, nextSlide){
var current = $(this).find(".slick-current iframe");
setTimeout( function(){current.attr('src', current.attr('src'));}, 1000);
var dataSettings = $(this).data('slider-options') || {};
});
//*********************************************
// TEAM TYPE 2 SCRIPTS
//*********************************************
// Team type 2 scripts
if ($(".team-type-2").exists()) {
$.fn.team2Function = function() {
$('.team-type-2 .member').each(function(){
var descBody = $(this).find('.member-description'),
$this = $(this),
descBodyHeight = $(descBody).height() / 2,
bodyHeight = $(this).find('.member-body').height() / 2;
if(!!('ontouchstart' in window)){//check for touch device
$('div').not($this).on('touchstart touchmove', function (e) {
$(descBody).css({'top': 0});
});
$('body').on('touchstart touchmove', function (e) {
$(descBody).css({'top': 0});
});
$this.on('touchstart touchend touchmove', function (e) {
$(descBody).css({'top': - bodyHeight - descBodyHeight - 20});
});
}else{
$(this).on('mouseover', function(){
var descBody = $(this).find('.member-description'),
descBodyHeight = $(descBody).height() / 2,
bodyHeight = $(this).find('.member-body').height() / 2;
$(descBody).css({'top': - bodyHeight - descBodyHeight - 20});
});
$(this).on('mouseout', function(){
$(descBody).css({'top': 0});
});
}
});
}
$('.team-type-2').team2Function();
$(window).resize(function(){ $('.team-type-2').team2Function(); });
}
//Calculate Items Width
$.fn.calculateWidth = function() {
$('.calculate-width').each(function(){
var $this = $(this), tagCount = $(this).find('> *').not('.no-calculate').length, tags = $(this).find('> *').not('.no-calculate'), contWidth = $(this).width();
$(this).addClass('clearfix'); $(tags).addClass('width-calculated').css({'width': contWidth / tagCount + 'px'});
});
}; $('body').calculateWidth();
//Quadra Interactive Packages Scripts
if ($(".interactive-packages").exists()){
$('.interactive-packages .steps .step').each(function(){
var itemNr = $(".step").index( this ) + 1,
$this = $(this),
stepW = $this.width(),
startWith = $('.interactive-packages .steps').attr('data-startWith');
$('.selector').css({'right': stepW / 2 + 'px'});
$('.interactive-packages .package_title span.title_selector').text(($(startWith).data('name')));
//Get texts
$('.interactive-packages .package-boxes .box1 span.box-title-selector').text(($(startWith).data('box1'))); $('.interactive-packages .package-boxes .box2 span.box-title-selector').text(($(startWith).data('box2'))); $('.interactive-packages .package-boxes .box3 span.box-title-selector').text(($(startWith).data('box3'))); $('.interactive-packages .package-boxes .box4 span.box-title-selector').text(($(startWith).data('box4')));
//Get elements when click
$this.on('click', function(){
var stepWidth = $('.steps .step').width();
$('.interactive_bar').css({'width': itemNr * stepWidth + 'px'}); $('.interactive-packages .title').removeClass('active'); $('.interactive-packages .title:nth-child(' + itemNr + ')').addClass('active'); $('.interactive-packages .package_title span.title_selector').text(($this.data('name'))); $('.interactive-packages .package-boxes .box1 span.box-title-selector').text(($this.data('box1')));
$('.interactive-packages .package-boxes .box2 span.box-title-selector').text(($this.data('box2'))); $('.interactive-packages .package-boxes .box3 span.box-title-selector').text(($this.data('box3'))); $('.interactive-packages .package-boxes .box4 span.box-title-selector').text(($this.data('box4')));
});
});
}
//*********************************************
// WINDOW RESIZE FUNCTION
//*********************************************
// Quadra Functions when window resizing.
$(window).resize(function(){
//Vertical Center Function
$('body').verticalPosition();
//Vertical Center Function
$('body').makeFullscreen();
//Make Fullscreen
$('.bodywidth').width($(window).width());
//Calculate Width
$('body').calculateWidth();
//Get device width
$('body').getDeviceWidth();
//Animated Items
$('body').animatedItems();
// Refresh the parallax
if (isParallaxBrowsers && mobile === false) {$(window).data('plugin_stellar').refresh(); }
//Calculate Height
setTimeout( function(){ $('.calculate-height').calculateHeight(); }, 30);
//Make Min Height Full
$('.mnh-full').css({'min-height': $(window).height() + 'px' });
//Make Height Full
$('.height-full').css({'height': $(window).height() + 'px' });
//Mega menu position calculating
$('.to-center').each(function() { var menuW = $(this).outerWidth(); if ($(window).width() > 1200) { $(this).css({'left': - menuW / 2 + 40 + 'px'}); $('.mega-menu').removeClass('mini-screen');} if ($(window).width() < 1200) { $(this).css({'left': - menuW / 3 + 150 + 'px'});$('.mega-menu').addClass('mini-screen') } });
if ($(window).width() > 1120) {
$('#pagetop').each(function(){ var itemH = $(this).outerHeight(), bigNav = $('#navigation.modern').not('.sticky, .static'); bigNav.addClass('pagetopped').css("margin-top", itemH + 'px')});
} else {
$('#navigation.modern').not('.sticky, .static').css({"margin-top": 0});
}
//Change background images for large and small screens
if ($(window).width() < 769 ) {
$("[data-mobile-background]").each(function(){var bgSRC = $(this).data('mobile-background');$(this).css({'background-image': 'url(' + bgSRC + ')', 'background-size': 'cover !important'}); });
} else{
$("[data-background]").each(function () {var bgSRC = $(this).data('background');$(this).removeClass('bg-mobiled').css({'background-image': 'url(' + bgSRC + ')'}); });
}
//do something else
});
//Close the page loader
var $pageloader = $('.page-loader');
setTimeout(function() {
$pageloader.addClass("page-loader--fading-out");
}, 100);
setTimeout(function() {
$pageloader.removeClass("page-loader--fading-out").addClass("page-loader--hidden");
}, 600);
//Window Before Unloading
if (isParallaxBrowsers) {
$(window).on('beforeunload', function (e) {
$pageloader.removeClass("page-loader--hidden").addClass("page-loader--fading-in");
});
}
$('a[href^="mailto:"], a[href^="tel:"]').on('click', function(){
setTimeout(function() {
$pageloader.removeClass("page-loader--fading-out").addClass("page-loader--hidden");
}, 50);
});
//Animated Items for desktops
$.fn.animatedItems = function() {
if ( $(window).width() > 1024 && mobile === false) {
$('.animated').not('.hero-slider .animated').each(function() {
var item = $(this), animation = item.data('animation');
$(item).waypoint(function() {
if ( !item.hasClass('visible') ) {
var animationDelay = item.data('animation-delay');
if ( animationDelay ) { setTimeout(function(){ item.addClass( animation + " visible" ); }, animationDelay); }
else { item.addClass( animation + " visible" ); }
}
}, {offset: '90%'});
});
} else { $('.animated').not('.hero-slider .animated').addClass("visible") }
}
$("body").animatedItems();
//Animated Backgrounds for desktops
$(".bg-animated, .bg-animated-reverse, .bg-animated-vertical").each(function(){ $("").appendTo(this); });
//Same Height Items
$.fn.calculateHeight = function () {
$('.calculate-height').each(function() {
var maxHeight = -1;
$(this).find('>*').css({'height': 'auto'}).each(function() {
if ($(this).outerHeight() > maxHeight) { maxHeight = $(this).outerHeight();}
});
$(this).find('>*').outerHeight(maxHeight);
});
};
$('.calculate-height').calculateHeight();
//Sticky Items
if ($(".sticky-item").exists()) {
$(".sticky-item").each(function(){
var spacing = $(this).data('top-spacing');
$(this).sticky({topSpacing:spacing});
})
}
//Sticky elements to containers
if ($(".sticky-container").exists()) {
$(".sticky-container").each(function(){
//Variations
var $stick = $(this),
$width = $($stick).width(),
$stickTop = $($stick).offset().top,
$container = $($stick).data('fix-container'),
$contStart = $($container).offset().top,
$contEnd = $($container).height() - $($stick).height(),
$spacing = $($stick).data('top-spacing'),
$endValue = $contStart + $($container).outerHeight() - $($stick).height();
//Screen Positions
$(window).on("scroll", function () {
$.fn.makeSticky = function() {
var now = $(window).scrollTop() + $spacing;
if (now < $stickTop ) { $($stick).css({'top': '0px', 'position': 'absolute', 'max-width': $width + 'px' }).addClass('before-cont').removeClass('on-cont after-cont'); }
if (now > $stickTop ) {$($stick).css({'top': $spacing + 'px', 'position': 'fixed', 'max-width': $width + 'px' }).addClass('on-cont').removeClass('before-cont after-cont'); }
if (now > $endValue ) { $($stick).css({'top': $contEnd + 'px', 'position': 'absolute', 'max-width': $width + 'px' }).addClass('after-cont').removeClass('before-cont on-cont'); }
};
if ($($container).has($stick) && $(window).width() > 1000 ) {$($stick).makeSticky();}
});
});
}
//Call Ajax
if ($("[data-ajax-load]").exists()) {
$('[data-ajax-load]').each(function(){
var value = $(this).data("ajax-load"),
$this = $(this);
$(this).empty().load(value, function(){
if ($($this).hasClass('ajax-slider')) {
var $sldr = $(this).find('.custom-slider');
$sldr.slick();
}
});
});
}
//Refresh parallax effect after all scripts on desktops
if (isParallaxBrowsers && mobile === false) {
setTimeout( function(){ $(window).data('plugin_stellar').refresh(); }, 100);
}
//*********************************************
}); // END WINDOW LOAD FUNCTION
//*********************************************
//Get Background Image
$("[data-background]").not('.bg-mobiled').each(function () {
var bgSRC = $(this).data('background');
var self = $(this);
$(this).css({'background-image': 'url(' + bgSRC + ')'});
$(self).ready( function() {
setTimeout( function(){$(self).addClass('loaded'); }, 50);
});
});
//Side menu trigger for body
$('body').has('#navigation.side-menu.left').addClass('left-side-menu-active');
$('body').has('#navigation.side-menu.right').addClass('right-side-menu-active');
$('body').has('#navigation.mini-side-menu.left').addClass('left-mini-side-menu-active');
$('body').has('#navigation.mini-side-menu.right').addClass('right-mini-side-menu-active');
// Parallax backgrounds
$('.bg-parallax').each(function(){ var $this = $(this); $($this).closest('section, .parallax-container').addClass('o-hidden relative z-index-1');});
//Make Fullscreen
$.fn.makeFullscreen = function() {
if ($('body').has('#navigation.side-menu') || $('body').has('#mini-side-menu') ) {
$('.fullscreen').width($('#content').width() ).height($(window).height());
} else {
$('.fullscreen').width($(window).width() ).height($(window).height());
}
};$('body').makeFullscreen();
//Make Bodywidth
$('.bodywidth').width($(window).width());
//Make Min Height Full
$('.mnh-full').css({'min-height': $(window).height() + 'px' });
//Make Height Full
$('.height-full').css({'height': $(window).height() + 'px' });
//Count To
$.fn.countTo = function(options) {
// merge the default plugin settings with the custom options
options = $.extend({}, $.fn.countTo.defaults, options || {});
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(options.speed / options.refreshInterval),
increment = (options.to - options.from) / loops;
return $(this).each(function() {
var _this = this,
loopCount = 0,
value = options.from,
interval = setInterval(updateTimer, options.refreshInterval);
function updateTimer() {
value += increment;
loopCount++;
$(_this).html(value.toFixed(options.decimals).replace(/\B(?=(\d{3})+(?!\d))/g, "."));
if (typeof(options.onUpdate) === 'function') {
options.onUpdate.call(_this, value);
}
if (loopCount >= loops) {
clearInterval(interval);
value = options.to;
if (typeof(options.onComplete) === 'function') {
options.onComplete.call(_this, value);
}
}
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 100, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
onUpdate: null, // callback method for every time the element is updated,
onComplete: null, // callback method for when the element finishes updating
};
// Count options
$('.fact').each(function() {
$(this).waypoint(function() {
dataSource = $(this.element).attr('data-source'),
//Count Factors Options
$(this.element).find('.factor').countTo({
from: 0,
to: dataSource,
speed: 2000,
refreshInterval: 25
});
this.destroy();
}, {offset: '100%'});
});
// Digits for numbers (.digits class).
$.fn.digits = function(){ return this.each(function(){ $(this).text( $(this).text().replace(/\B(?=(\d{3})+(?!\d))/g, ".")) }); }
$(".digits").digits();
if ($('.countdown').length > 0){
$(".countdown").each(function(){
var $this = $(this),
Dtimer = $(this).attr("data-time");
//Countdowns
CountDownTimer(Dtimer);
//Countdown Scripts
function CountDownTimer(dt){
var end = new Date(dt), _second = 1000, _minute = _second * 60, _hour = _minute * 60, _day = _hour * 24, _year = _day * 365, timer,
cls = $($this);
function showRemaining() {
var now = new Date();
var distance = end - now;
//Finished Timer
if (distance < 0) {
clearInterval(timer);
$($this).html('EXPIRED');
return;
}
//Math for times
var years = Math.floor(distance / _year),
days = Math.floor((distance % _year) / _day),
hours = Math.floor((distance % _day) / _hour),
minutes = Math.floor((distance % _hour) / _minute),
seconds = Math.floor((distance % _minute) / _second);
if (String(hours).length < 2){ hours = 0 + String(hours); }
if (String(minutes).length < 2){ minutes = 0 + String(minutes); }
if (String(seconds).length < 2){ seconds = 0 + String(seconds); }
var datestr = '