"use strict";
window.odometerOptions = {
auto: true, // Don't automatically initialize everything with class 'odometer'
selector: '.number.animated-element', // Change the selector used to automatically find things to be animated
format: '(ddd).dd', // Change how digit groups are formatted, and how many digits are shown after the decimal point
duration: 2000, // Change how long the javascript expects the CSS animation to take
theme: 'default', // Specify the theme (if you have more than one theme css file on the page)
animation: 'count' // Count is a simpler animation method which just increments the value,
// use it when you're looking for something more subtle.
};
var menu_position = null;
var modificator = 0;
jQuery(document).ready(function($){
//preloader
var preloader = function()
{
$(".blog a.post-image>img, .post.single .post-image img, .services-list a>img, .projects-list:not('.isotope') a>img, .cm-preload>img, .wpb_single_image img").each(function(){
$(this).before("");
imagesLoaded($(this)).on("progress", function(instance, image){
$(image.img).prev(".cm-preloader").remove();
if($(image.img).prev(".post-date").length)
{
$(image.img).prev(".post-date").fadeTo("slow", 1, function(){
$(this).css("opacity", "");
});
}
$(image.img).css("display", "block");
$(image.img).parent().css("opacity", "0");
$(image.img).parent().fadeTo("slow", 1, function(){
$(this).css("opacity", "");
});
});
});
};
preloader();
//search form
$(".template-search").on("click", function(event){
event.preventDefault();
$(this).parent().children(".search-form").toggle();
});
//mobile menu
$(".mobile-menu").prepend("
");
$(".mobile-menu-switch").on("click", function(event){
event.preventDefault();
if(!$(".mobile-menu-container nav .mobile-menu").is(":animated"))
{
if(!$(".mobile-menu-container nav .mobile-menu").is(":visible"))
$(".header-container").css("z-index", 4);
$(".mobile-menu-container nav .mobile-menu").slideToggle(500, function(){
if(!$(".mobile-menu-container nav .mobile-menu").is(":visible"))
$(".header-container").css("z-index", 3);
});
}
});
$(".mobile-menu .template-arrow-vertical-3").on("click", function(event){
event.preventDefault();
if(!$(".mobile-menu-container nav .mobile-menu").is(":animated"))
{
if(!$(".mobile-menu-container nav .mobile-menu").is(":visible"))
$(".header-container").css("z-index", 4);
$(".mobile-menu-container nav .mobile-menu").slideToggle(500, function(){
if(!$(".mobile-menu-container nav .mobile-menu").is(":visible"))
$(".header-container").css("z-index", 3);
});
}
});
$(".collapsible-mobile-submenus .template-arrow-menu").on("click", function(event){
event.preventDefault();
$(this).next().slideToggle(300);
$(this).toggleClass("template-arrow-expanded");
});
//header toggle
if($(".header").width()<462 && !$(".header-top-bar").hasClass("hide-on-mobiles"))
$(".header-toggle").prev().hide();
$(".header-toggle").on("click", function(event){
event.preventDefault();
$(this).prev().slideToggle();
$(this).toggleClass("active");
});
//parallax
if(!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/))
{
$(".moving-parallax").each(function(){
$(this).parallax({
speed: -50
});
});
}
else
$(".cm-parallax").addClass("attachment-scroll");
//isotope
$(".isotope").each(function(index){
var self = $(this);
self.isotope({
layoutMode: 'fitRows',
fitRows: {
gutter: 30
},
isOriginLeft: (config.is_rtl ? false : true)
});
// layout Isotope after each image loads
self.imagesLoaded().progress( function() {
self.isotope('layout');
});
});
//testimonials
$(".testimonials-carousel").each(function(){
var self = $(this);
var length = $(this).children().length;
var elementClasses = $(this).attr('class').split(' ');
var autoplay = 0;
var pause_on_hover = 0;
var scroll = 1;
var effect = "scroll";
var easing = "easeInOutQuint";
var duration = 750;
for(var i=0; i");
$(".cm-preloader_" + index).imagesLoaded(function(){
$(".cm-preloader_" + index).prev(".cm-preloader").remove();
$(".cm-preloader_" + index).fadeTo("slow", 1, function(){
$(this).css("opacity", "");
});
var autoplay = 0;
var elementClasses = $(".cm-preloader_" + index).attr('class').split(' ');
for(var i=0; i750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2))) : 0),
visible: ($(".header").width()>750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2)))
},
scroll: {
items: ($(".header").width()>750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2))),
easing: "easeInOutQuint",
duration: 750
},
auto: {
play: (parseInt(autoplay, 10) ? true : false),
pauseOnHover: true
},
pagination: {
items: ($(".header").width()>750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2))),
container: $(self).next()
},
},
{
wrapper: {
classname: "caroufredsel-wrapper"
}
});
var base = "x";
var scrollOptions = {
scroll: {
easing: "easeInOutQuint",
duration: 750
}
};
self.swipe({
fallbackToMouseEvents: true,
allowPageScroll: "vertical",
excludedElements:"button, input, select, textarea, .noSwipe",
swipeStatus: function(event, phase, direction, distance, fingerCount, fingerData ) {
if(!self.is(":animated"))
{
self.trigger("isScrolling", function(isScrolling){
if(!isScrolling)
{
if (phase == "move" && (direction == "left" || direction == "right"))
{
if(base=="x")
{
self.trigger("configuration", scrollOptions);
self.trigger("pause");
}
if (direction == "left")
{
if(base=="x")
base = 0;
self.css("left", parseInt(base, 10)-distance + "px");
}
else if (direction == "right")
{
if(base=="x" || base==0)
{
self.children().last().prependTo(self);
base = -self.children().first().width()-parseInt(self.children().first().css("margin-right"), 10);
}
self.css("left", base+distance + "px");
}
}
else if (phase == "cancel")
{
if(distance!=0)
{
self.trigger("play");
self.animate({
"left": base + "px"
}, 750, "easeInOutQuint", function(){
if(base==-self.children().first().width()-parseInt(self.children().first().css("margin-right"), 10))
{
self.children().first().appendTo(self);
self.css("left", "0px");
base = "x";
}
self.trigger("configuration", {scroll: {
easing: "easeInOutQuint",
duration: 750
}});
});
}
}
else if (phase == "end")
{
self.trigger("play");
if (direction == "right")
{
self.trigger("prevPage");
self.children().first().appendTo(self);
self.animate({
"left": 0 + "px"
}, 200, "linear", function(){
self.trigger("configuration", {scroll: {
easing: "easeInOutQuint",
duration: 750
}});
base = "x";
});
}
else if (direction == "left")
{
if(base==-self.children().first().width()-parseInt(self.children().first().css("margin-right"), 10))
{
self.children().first().appendTo(self);
self.css("left", (parseInt(self.css("left"), 10)-base)+"px");
}
self.trigger("nextPage");
self.trigger("configuration", {scroll: {
easing: "easeInOutQuint",
duration: 750
}});
base = "x";
}
}
}
});
}
}
});
});
});
//horizontal carousel
var horizontalCarousel = function()
{
$(".horizontal-carousel").each(function(index){
$(this).addClass("cm-preloader-hr-carousel_" + index);
$(".cm-preloader-hr-carousel_" + index).before("");
$(".cm-preloader-hr-carousel_" + index).imagesLoaded(function(instance){
$(".cm-preloader-hr-carousel_" + index).prev(".cm-preloader").remove();
$(".cm-preloader-hr-carousel_" + index).fadeTo("slow", 1, function(){
$(this).css("opacity", "");
});
//caroufred
var visible = 3;
var autoplay = 0;
var pause_on_hover = 0;
var scroll = 3;
var effect = "scroll";
var easing = "easeInOutQuint";
var duration = 750;
var navigation = 1;
var control_for = "";
var elementClasses = $(".cm-preloader-hr-carousel_" + index).attr('class').split(' ');
for(var i=0; i3)
scroll = 3;
var self = $(".cm-preloader-hr-carousel_" + index);
var length = self.children().length;
self.data("scroll", scroll);
if(length462 ? 3 : 1) : 0),
visible: parseInt(scroll, 10)
},
scroll: {
items: parseInt(scroll, 10),
fx: effect,
easing: easing,
duration: parseInt(duration, 10),
pauseOnHover: (parseInt(pause_on_hover, 10) ? true : false),
onAfter: function(){
$(this).trigger('configuration', [{scroll :{
easing: "easeInOutQuint",
duration: 750
}}, true]);
}
},
auto: {
items: parseInt(scroll, 10),
play: (parseInt(autoplay, 10) ? true : false),
fx: effect,
easing: easing,
duration: parseInt(duration, 10),
pauseOnHover: (parseInt(pause_on_hover, 10) ? true : false),
onAfter: null
},
pagination: {
items: parseInt(scroll, 10),
container: $(self).next()
}
};
self.carouFredSel(carouselOptions,{
wrapper: {
classname: "caroufredsel-wrapper"
}
});
var base = "x";
var scrollOptions = {
scroll: {
easing: "linear",
duration: 200
}
};
self.swipe({
fallbackToMouseEvents: true,
allowPageScroll: "vertical",
excludedElements:"button, input, select, textarea, .noSwipe",
swipeStatus: function(event, phase, direction, distance, fingerCount, fingerData ) {
if(!self.is(":animated"))
{
self.trigger("isScrolling", function(isScrolling){
if(!isScrolling)
{
if (phase == "move" && (direction == "left" || direction == "right"))
{
if(base=="x")
{
self.trigger("configuration", scrollOptions);
self.trigger("pause");
}
if (direction == "left")
{
if(base=="x")
base = 0;
self.css("left", parseInt(base, 10)-distance + "px");
}
else if (direction == "right")
{
if(base=="x" || base==0)
{
self.children().slice(-self.data("scroll")).prependTo(self);
base = -self.data("scroll")*self.children().first().width()-self.data("scroll")*parseInt(self.children().first().css("margin-right"), 10);
}
self.css("left", base+distance + "px");
}
}
else if (phase == "cancel")
{
if(distance!=0)
{
self.trigger("play");
self.animate({
"left": base + "px"
}, 750, "easeInOutQuint", function(){
if(base==-self.data("scroll")*self.children().first().width()-self.data("scroll")*parseInt(self.children().first().css("margin-right"), 10))
{
self.children().slice(0, self.data("scroll")).appendTo(self);
self.css("left", "0px");
base = "x";
}
self.trigger("configuration", {scroll: {
easing: "easeInOutQuint",
duration: 750
}});
});
}
}
else if (phase == "end")
{
self.trigger("play");
if (direction == "right")
{
self.trigger('ql_set_page_nr', self.data("scroll"));
self.animate({
"left": 0 + "px"
}, 200, "linear", function(){
self.trigger("configuration", {scroll: {
easing: "easeInOutQuint",
duration: 750
}});
base = "x";
});
}
else if (direction == "left")
{
if(base==-self.children().first().width()-parseInt(self.children().first().css("margin-right"), 10))
{
self.children().first().appendTo(self);
self.css("left", (parseInt(self.css("left"), 10)-base)+"px");
}
self.trigger("nextPage");
self.trigger("configuration", {scroll: {
easing: "easeInOutQuint",
duration: 750
}});
base = "x";
}
}
}
});
}
}
});
});
});
};
horizontalCarousel();
//counters
var counters = function()
{
$(".counters-group").each(function(){
var groupHeight = $(this).height();
var topValue = 0, currentValue = 0;
var counterBoxes = $(this).find(".counter-box")
counterBoxes.each(function(index){
var self = $(this);
if(self.find("[data-value]").length)
{
currentValue = parseInt(self.find("[data-value]").data("value").toString().replace(" ",""), 10);
if(currentValue>topValue)
topValue = currentValue;
}
});
var height = 83/groupHeight*100; //var height = 0/groupHeight*100;
counterBoxes.each(function(index){
var self = $(this);
currentValue = parseInt(self.find("[data-value]").data("value").toString().replace(" ",""), 10);
height = 83*(1-currentValue/topValue)/groupHeight*100; //height = 0*(1-currentValue/topValue)/groupHeight*100;
self.find(".ornament-container").css("height", currentValue/topValue*100+height + "%");
});
});
$(".single-counter-box").each(function(){
var value = $(this).find("[data-value]");
if(value.length)
$(this).find(".ornament-container").css("width", "calc(" + value.data("value").toString().replace(" ","") + "%" + " - 10px)");
});
}
counters();
//accordion
$(".accordion").each(function(){
var active_tab = !isNaN(jQuery(this).data('active-tab')) && parseInt(jQuery(this).data('active-tab')) > 0 ? parseInt(jQuery(this).data('active-tab'))-1 : false,
collapsible = (active_tab===false ? true : false);
$(this).accordion({
event: 'change',
heightStyle: 'content',
icons: {"header": "template-plus", "activeHeader": "template-minus"},
active: active_tab,
collapsible: collapsible,
create: function(event, ui){
$(window).trigger('resize');
$(".horizontal_carousel").trigger('configuration', ['debug', false, true]);
}
});
});
$(".accordion.wide").on("accordionchange", function(event, ui){
$("html, body").animate({scrollTop: $("#"+$(ui.newHeader).attr("id")).offset().top}, 400);
});
$(".tabs").tabs({
event: 'change',
show: 200,
hide: 200,
create: function(){
$("html, body").scrollTop(0);
},
activate: function(event, ui){
ui.oldPanel.find(".submit-contact-form, .cost-calculator-submit-form, [name='submit'], [name='name'], [name='email'], [name='phone'], [name='message'], .g-recaptcha, [name='terms']").qtip('hide');
}
});
//browser history
$(".tabs .ui-tabs-nav a").on("click", function(){
if($(this).attr("href").substr(0,4)!="http")
$.bbq.pushState($(this).attr("href"));
else
window.location.href = $(this).attr("href");
});
$(".ui-accordion .ui-accordion-header").on("click", function(){
$.bbq.pushState("#" + $(this).attr("id").replace("accordion-", ""));
});
$(".scroll-to-comments").on("click", function(event){
event.preventDefault();
var offset = $("#comments-list").offset();
if(typeof(offset)!="undefined")
$("html, body").animate({scrollTop: offset.top-90}, 400);
});
$(".scroll-to-comment-form").on("click", function(event){
event.preventDefault();
var offset = $("#comment-form").offset();
if(typeof(offset)!="undefined")
$("html, body").animate({scrollTop: offset.top-90}, 400);
});
//hashchange
$(window).on("hashchange", function(event){
var hashSplit = $.param.fragment().split("-");
var hashString = "";
for(var i=0; i462)
{
var topOfWindow = $(window).scrollTop();
$(".cm-smart-column").each(function(){
var row = $(this).parent();
var wrapper = $(this).children().first();
var childrenHeight = 0;
wrapper.children().each(function(){
childrenHeight += $(this).outerHeight(true);
});
if(childrenHeight<$(window).height() && row.offset().top-20topOfWindow)
{
wrapper.css({"position": "fixed", "bottom": "auto", "top": "20px", "width": $(this).width() + "px"});
$(this).css({"height": childrenHeight+"px"});
}
else if(childrenHeight<$(window).height() && row.offset().top-20+row.height()-childrenHeight<=topOfWindow && (row.height()-childrenHeight>0))
{
wrapper.css({"position": "absolute", "bottom": "0", "top": (row.height()-childrenHeight) + "px", "width": "100%"});
$(this).css({"height": childrenHeight+"px"});
}
else if(childrenHeight>=$(window).height() && row.offset().top+20+childrenHeighttopOfWindow+$(window).height())
{
wrapper.css({"position": "fixed", "bottom": "20px", "top": "auto", "width": $(this).width() + "px"});
$(this).css({"height": childrenHeight+"px"});
}
else if(childrenHeight>=$(window).height() && row.offset().top+20+row.height()<=topOfWindow+$(window).height() && (row.height()-childrenHeight>0))
{
wrapper.css({"position": "absolute", "bottom": "0", "top": (row.height()-childrenHeight) + "px", "width": "100%"});
$(this).css({"height": childrenHeight+"px"});
}
else
{
wrapper.css({"position": "static", "bottom": "auto", "top": "auto", "width": "auto"});
$(this).css({"height": childrenHeight + "px"});
}
});
}
$(".horizontal-carousel").each(function(){
var self = $(this);
//caroufred
var scroll = 3;
var elementClasses = self.attr('class').split(' ');
for(var i=0; i3)
scroll = 3;
self.trigger("configuration", {
items: {
visible: parseInt(scroll, 10)
},
scroll: {
items: parseInt(scroll, 10)
},
pagination: {
items: parseInt(scroll, 10)
}
});
});
$(".our-clients-list:not('.type-list')").each(function(){
var self = $(this);
self.trigger("configuration", {
items: {
visible: ($(".header").width()>750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2)))
},
scroll: {
items: ($(".header").width()>750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2)))
},
pagination: {
items: ($(".header").width()>750 ? 5 : ($(".header").width()>462 ? 4 : ($(".header").width()>300 ? 3 : 2)))
}
});
});
if(!$(".header-top-bar").hasClass("hide-on-mobiles"))
{
if($(".header").width()>300)
{
$(".header-top-bar").css("display", "block");
}
else
{
if($(".header-top-bar").is(":visible"))
{
$(".header-top-bar").css("display", "flex");
$(".header-toggle").addClass("active");
}
}
}
//isotope
$(".isotope").each(function(index){
$(this).isotope('layout');
});
if($(".sticky").length)
{
if($(".header-container").hasClass("sticky"))
menu_position = $(".header-container").offset().top;
var topOfWindow = $(window).scrollTop();
if(menu_position!=null && $(".header-container .sf-menu").is(":visible"))
{
if($(".transparent-header-container").length)
modificator = 7;
if(menu_position+modificatortopOfWindow)
{
wrapper.css({"position": "fixed", "bottom": "auto", "top": "20px", "width": $(this).width() + "px"});
$(this).css({"height": childrenHeight+"px"});
}
else if(childrenHeight<$(window).height() && row.offset().top-20+row.height()-childrenHeight<=topOfWindow && (row.height()-childrenHeight>0))
{
wrapper.css({"position": "absolute", "bottom": "0", "top": (row.height()-childrenHeight) + "px", "width": "100%"});
$(this).css({"height": childrenHeight+"px"});
}
else if(childrenHeight>=$(window).height() && row.offset().top+20+childrenHeighttopOfWindow+$(window).height())
{
wrapper.css({"position": "fixed", "bottom": "20px", "top": "auto", "width": $(this).width() + "px"});
$(this).css({"height": childrenHeight+"px"});
}
else if(childrenHeight>=$(window).height() && row.offset().top+20+row.height()<=topOfWindow+$(window).height() && (row.height()-childrenHeight>0))
{
wrapper.css({"position": "absolute", "bottom": "0", "top": (row.height()-childrenHeight) + "px", "width": "100%"});
$(this).css({"height": childrenHeight+"px"});
}
else
wrapper.css({"position": "static", "bottom": "auto", "top": "auto", "width": "auto"});
}
else if($(this).hasClass("sticky"))
{
if(menu_position!=null && $(".header-container .sf-menu").is(":visible"))
{
if($(".transparent-header-container").length)
modificator = 7;
if(menu_position+modificator$(document).height()/2 ? $(window).height()/2 : $(document).height()/2);
if(topOfWindow+800 ? parseInt(input.val())-1 : 0));
$("input[name='update_cart']").removeAttr("disabled");
});
$(document.body).on("updated_cart_totals", function(){
$(".woocommerce .quantity .plus").off("click");
$(".woocommerce .quantity .plus").on("click", function(){
var input = $(this).prev();
input.val(parseInt(input.val())+1);
$("input[name='update_cart']").removeAttr("disabled");
});
$(".woocommerce .quantity .minus").off("click");
$(".woocommerce .quantity .minus").on("click", function(){
var input = $(this).next();
input.val((parseInt(input.val())-1>0 ? parseInt(input.val())-1 : 0));
$("input[name='update_cart']").removeAttr("disabled");
});
var sum = 0;
$(".shop_table.cart .input-text.qty.text").each(function(){
sum += parseInt($(this).val());
});
if(sum>0)
$(".cart-items-number").html(sum).css("display", "block");
});
$(document.body).on("added_to_cart", function(event, data){
var sum = 0;
$(data["div.widget_shopping_cart_content"]).find(".quantity").each(function(){
sum += parseInt($(this).html());
});
if(sum>0)
{
if(typeof(config.cart_url)!="undefined")
$(".template-cart").attr("href", config.cart_url);
$(".cart-items-number").html(sum + '').css("display", "block");
}
});
});