( function( $, elementor ) {
"use strict";
var WPKoiElements = {
init: function() {
elementor.hooks.addAction( 'frontend/element_ready/section', WPKoiElements.elementorSection );
},
elementorSection: function( $scope ) {
var $target = $scope,
instance = null,
editMode = Boolean( elementor.isEditMode() );
instance = new wpkoiSectionParallax( $target );
instance.init();
},
};
$( window ).on( 'elementor/frontend/init', WPKoiElements.init );
window.wpkoiSectionParallax = function( $target ) {
var self = this,
sectionId = $target.data('id'),
settings = false,
editMode = Boolean( elementor.isEditMode() ),
$window = $( window ),
$body = $( 'body' ),
scrollLayoutList = [],
mouseLayoutList = [],
winScrollTop = $window.scrollTop(),
winHeight = $window.height(),
requesScroll = null,
requestMouse = null,
tiltx = 0,
tilty = 0,
isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/),
platform = navigator.platform;
self.init = function() {
if ( ! editMode ) {
settings = self.getSettingsFromSection($target);
} else {
settings = self.generateEditorSettings( sectionId );
}
if (!settings) {
return false;
}
$target.addClass('wpkoi-parallax-section');
self.generateLayouts();
if (scrollLayoutList.length !== 0) {
$window.on('scroll.wpkoiSectionParallax resize.wpkoiSectionParallax', self.scrollHandler );
}
self.scrollUpdate();
};
self.generateEditorSettings = function( sectionId ) {
var editorElements = null,
sectionsData = {},
sectionData = {},
sectionParallaxData = {},
settings = [];
if ( ! window.elementor.hasOwnProperty( 'elements' ) ) {
return false;
}
editorElements = window.elementor.elements;
if ( ! editorElements.models ) {
return false;
}
$.each( editorElements.models, function( index, obj ) {
if ( sectionId == obj.id ) {
sectionData = obj.attributes.settings.attributes;
}
} );
if ( ! sectionData.hasOwnProperty( 'wpkoi_parallax_layout_image' ) || 0 === Object.keys( sectionData ).length ) {
return false;
}
return {
'wpkoi_parallax_layout_list' : {
'imageData': sectionData['wpkoi_parallax_layout_image'] || '',
'wpkoi_parallax_layout_image' : sectionData['wpkoi_parallax_layout_image'] || '',
'wpkoi_parallax_layout_speed': sectionData['wpkoi_parallax_layout_speed'] || 50,
'wpkoi_parallax_layout_type': sectionData['wpkoi_parallax_layout_type'] || 'scroll',
'wpkoi_parallax_layout_scale': sectionData['wpkoi_parallax_layout_scale'] || 100,
'wpkoi_parallax_layout_bg_x': sectionData['wpkoi_parallax_layout_bg_x'] || 50,
'wpkoi_parallax_layout_bg_y': sectionData['wpkoi_parallax_layout_bg_y'] || 50,
'wpkoi_parallax_layout_z_index': sectionData['wpkoi_parallax_layout_z_index'] || '',
'wpkoi_parallax_layout_bg_size': sectionData['wpkoi_parallax_layout_bg_size'] || 'auto',
'wpkoi_parallax_layout_animation_prop': sectionData['wpkoi_parallax_layout_animation_prop'] || 'transform',
}
}
};
self.getSettingsFromSection = function($target) {
var sectionSettings = $target.data('settings') || {};
if (!sectionSettings.hasOwnProperty('wpkoi_parallax_layout_image') || !sectionSettings.wpkoi_parallax_layout_image.url) {
return false;
}
return [{
'wpkoi_parallax_layout_image': sectionSettings.wpkoi_parallax_layout_image,
'wpkoi_parallax_layout_speed': sectionSettings.wpkoi_parallax_layout_speed || {'unit':'%','size':10},
'wpkoi_parallax_layout_type': sectionSettings.wpkoi_parallax_layout_type || 'mouse',
'wpkoi_parallax_layout_scale': sectionSettings.wpkoi_parallax_layout_scale || {'unit':'%','size':100},
'wpkoi_parallax_layout_bg_x': sectionSettings.wpkoi_parallax_layout_bg_x || 50,
'wpkoi_parallax_layout_bg_y': sectionSettings.wpkoi_parallax_layout_bg_y || 50,
'wpkoi_parallax_layout_z_index': sectionSettings.wpkoi_parallax_layout_z_index || '',
'wpkoi_parallax_layout_bg_size': sectionSettings.wpkoi_parallax_layout_bg_size || 'contain',
'wpkoi_parallax_layout_animation_prop': sectionSettings.wpkoi_parallax_layout_animation_prop || 'transform',
}];
};
self.generateLayouts = function() {
$('.wpkoi-parallax-section__layout', $target).remove();
$.each(settings, function(index, layout) {
var mmscales = layout['wpkoi_parallax_layout_scale']['size'] || 100;
var imageData = layout['wpkoi_parallax_layout_image'],
speed = layout['wpkoi_parallax_layout_speed']['size'] || 200,
speed = speed / 3,
speedmatrix = speed / 10,
mmspeed = 100 - speed,
mmscale = mmscales,
mmscaleste = mmscale / 100,
zIndex = layout['wpkoi_parallax_layout_z_index'],
bgSize = layout['wpkoi_parallax_layout_bg_size'] || 'auto',
animProp = layout['wpkoi_parallax_layout_animation_prop'] || 'bgposition',
bgX = layout['wpkoi_parallax_layout_bg_x'],
bgY = layout['wpkoi_parallax_layout_bg_y'],
type = layout['wpkoi_parallax_layout_type'] || 'none',
idofimage = 'koi55555',
$layout = null,
safariClass = isSafari ? ' is-safari' : '',
macClass = platform === 'MacIntel' ? ' is-mac' : '',
newtrickDeviceMode = elementorFrontend.getCurrentDeviceMode();
if (!imageData.url) {
return false;
}
if (type === 'mouse') {
$layout = $('')
.prependTo($target)
.css({
'z-index': zIndex
});
} else if (type === 'matrix') {
$layout = $('')
.prependTo($target)
.css({
'z-index': zIndex
});
} else {
$layout = $('')
.prependTo($target)
.css({
'z-index': zIndex
});
}
$('.wpkoi-parallax-section__image', $layout).css({
'background-image': 'url(' + imageData.url + ')',
'background-size': bgSize,
'background-position-x': bgX + '%',
'background-position-y': bgY + '%',
});
var layoutData = {
selector: $layout,
image: imageData.url,
size: bgSize,
prop: animProp,
type: type,
xPos: bgX,
yPos: bgY,
speed: 2 * (speed / 100)
};
if (type !== 'none') {
if (type === 'scroll' || type === 'zoom') {
scrollLayoutList.push(layoutData);
} else if (type === 'mouse') {
mouseLayoutList.push(layoutData);
}
}
});
};
self.scrollHandler = function() {
winScrollTop = $window.scrollTop();
self.scrollUpdate();
};
self.scrollUpdate = function() {
$.each(scrollLayoutList, function(index, layout) {
var $this = layout.selector,
$image = $( '.wpkoi-parallax-section__image', $this ),
speed = layout.speed,
offsetTop = $this.offset().top,
thisHeight = $this.outerHeight(),
prop = layout.prop,
type = layout.type,
posY = ( winScrollTop - offsetTop + winHeight ) / thisHeight * 100,
device = elementorFrontend.getCurrentDeviceMode();
if ( winScrollTop < offsetTop - winHeight ) posY = 0;
if ( winScrollTop > offsetTop + thisHeight) posY = 200;
posY = parseFloat( speed * posY ).toFixed(1);
switch( type ) {
case 'scroll':
if ( 'bgposition' === layout.prop ) {
$image.css( {
'background-position-y': 'calc(' + layout.yPos + '% + ' + posY + 'px)'
} );
} else {
$image.css( {
'transform': 'translateY(' + posY + 'px)'
} );
}
break;
case 'zoom':
var deltaScale = ( winScrollTop - offsetTop + winHeight ) / winHeight,
scale = deltaScale * speed;
scale = scale + 1;
$image.css( {
'transform': 'scale(' + scale + ')'
} );
break;
}
});
};
self.mouseHandler = function(event) {
if (requestMouse) {
cancelAnimationFrame(requestMouse);
}
tiltx = (event.pageX - $window.width() / 2) / ($window.width() / 2);
tilty = (event.pageY - $window.height() / 2) / ($window.height() / 2);
requestMouse = requestAnimationFrame(self.mouseUpdate);
};
self.mouseUpdate = function() {
$.each(mouseLayoutList, function(index, layout) {
$(layout.selector).css('transform', 'translate3d(' + (tiltx * layout.speed * 100) + 'px, ' + (tilty * layout.speed * 100) + 'px, 0) scale(' + layout.scale + ')');
});
};
};
} )( jQuery, window.elementorFrontend );
function Parallax(options){
jQuery(document).ready(function($) {
options = options || {};
this.nameSpaces = {
wrapper: options.wrapper || '.wpkoi-parallax-section',
layers: options.layers || '.wpkoi-parallax-section__mouse-layout .wpkoi-parallax-section__image',
deep: options.deep || 'data-parallax-deep',
scale: options.scale || 'data-parallax-scale'
};
this.init = function() {
var self = this,
parallaxWrappers = document.querySelectorAll(this.nameSpaces.wrapper);
for(var i = 0; i < parallaxWrappers.length; i++){
(function(i){
parallaxWrappers[i].addEventListener('mousemove', function(e){
var x = e.clientX,
y = e.clientY,
layers = parallaxWrappers[i].querySelectorAll(self.nameSpaces.layers);
for(var j = 0; j < layers.length; j++){
(function(j){
var deep = layers[j].getAttribute(self.nameSpaces.deep),
scale = layers[j].getAttribute(self.nameSpaces.scale),
scale = scale / 100,
disallow = layers[j].getAttribute('data-parallax-disallow'),
itemX = (disallow && disallow === 'x') ? 0 : x / deep - 10,
itemY = (disallow && disallow === 'y') ? 0 : y / deep - 10;
if(disallow && disallow === 'both') return;
layers[j].style.transform = 'translateX(' + itemX + '%) translateY(' + itemY + '%) scale(' + scale + ')';
layers[j].style.transitionDuration = '0s';
})(j);
}
})
parallaxWrappers[i].addEventListener('mouseleave', function(e){
var layers = parallaxWrappers[i].querySelectorAll(self.nameSpaces.layers);
for(var j = 0; j < layers.length; j++){
(function(j){
var scale = layers[j].getAttribute(self.nameSpaces.scale),
scale = scale / 100,
disallow = layers[j].getAttribute('data-parallax-disallow');
if(disallow && disallow === 'both') return;
layers[j].style.transform = 'translateX(0%) translateY(0%) scale(' + scale + ')';
layers[j].style.transitionDuration = '0.5s';
})(j);
}
})
})(i);
}
};
this.init();
return this;
});
}
jQuery(document).ready(function($) {
new Parallax();
});
jQuery(function(l){if("undefined"==typeof wc_address_i18n_params)return!1;var e=wc_address_i18n_params.locale.replace(/"/g,'"'),n=JSON.parse(e);function o(e,a){a?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append(' *')):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append(' ('+wc_address_i18n_params.i18n_optional_text+")"))}l(document.body).on("country_to_state_changing",function(e,a,i){var d=i,r="undefined"!=typeof n[a]?n[a]:n["default"],i=d.find("#billing_postcode_field, #shipping_postcode_field"),a=d.find("#billing_city_field, #shipping_city_field"),t=d.find("#billing_state_field, #shipping_state_field"),i=(i.attr("data-o_class")||(i.attr("data-o_class",i.attr("class")),a.attr("data-o_class",a.attr("class")),t.attr("data-o_class",t.attr("class"))),JSON.parse(wc_address_i18n_params.locale_fields));l.each(i,function(e,a){var a=d.find(a),i=l.extend(!0,{},n["default"][e],r[e]);"undefined"!=typeof i.label&&a.find("label").html(i.label),"undefined"!=typeof i.placeholder&&(a.find(":input").attr("placeholder",i.placeholder),a.find(":input").attr("data-placeholder",i.placeholder),a.find(".select2-selection__placeholder").text(i.placeholder)),"undefined"!=typeof i.placeholder||"undefined"==typeof i.label||a.find("label").length||(a.find(":input").attr("placeholder",i.label),a.find(":input").attr("data-placeholder",i.label),a.find(".select2-selection__placeholder").text(i.label)),"undefined"!=typeof i.required?o(a,i.required):o(a,!1),"undefined"!=typeof i.priority&&a.data("priority",i.priority),"state"!==e&&("undefined"!=typeof i.hidden&&!0===i.hidden?a.hide().find(":input").val(""):a.show()),Array.isArray(i["class"])&&(a.removeClass("form-row-first form-row-last form-row-wide"),a.addClass(i["class"].join(" ")))}),l(".woocommerce-billing-fields__field-wrapper,.woocommerce-shipping-fields__field-wrapper,.woocommerce-address-fields__field-wrapper,.woocommerce-additional-fields__field-wrapper .woocommerce-account-fields").each(function(e,a){var a=l(a).find(".form-row"),i=a.first().parent(),d=0;a.each(function(){l(this).data("priority")||l(this).data("priority",d+1),d=l(this).data("priority")}),a.sort(function(e,a){e=parseInt(l(e).data("priority"),10),a=parseInt(l(a).data("priority"),10);return a
Hemz International