/* mk_icon_box2 */
/* mk_contact_form */
(function($) {
'use strict';
var _toBuild = [];
MK.component.AdvancedGMaps = function(el) {
var $this = $(el),
container = document.getElementById( 'mk-theme-container' ),
data = $this.data( 'advancedgmaps-config' ),
map = null,
bounds = null,
infoWindow = null,
position = null;
var build = function() {
data.options.scrollwheel = false;
data.options.mapTypeId = google.maps.MapTypeId[data.options.mapTypeId];
data.options.styles = data.style;
bounds = new google.maps.LatLngBounds();
map = new google.maps.Map(el, data.options);
infoWindow = new google.maps.InfoWindow();
map.setOptions({
panControl : data.options.panControl,
draggable: data.options.draggable,
zoomControl: data.options.zoomControl,
mapTypeControl: data.options.scaleControl,
scaleControl: data.options.mapTypeControl,
});
var marker, i;
map.setTilt(45);
for (i = 0; i < data.places.length; i++) {
if(data.places[i].latitude && data.places[i].longitude) {
position = new google.maps.LatLng(data.places[i].latitude, data.places[i].longitude);
bounds.extend(position);
marker = new google.maps.Marker({
position: position,
map: map,
title: data.places[i].address,
icon: (data.places[i].marker) ? data.places[i].marker : data.icon
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
if(data.places[i].address && data.places[i].address.length > 1) {
infoWindow.setContent('
'+ data.places[i].address +'
');
infoWindow.open(map, marker);
} else {
infoWindow.setContent('');
infoWindow.close();
}
};
})(marker, i));
map.fitBounds(bounds);
}
}
var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
this.setZoom(data.options.zoom);
google.maps.event.removeListener(boundsListener);
});
var update = function() {
google.maps.event.trigger(map, "resize");
map.setCenter(position);
};
update();
var bindEvents = function() {
$( window ).on( 'resize', update );
window.addResizeListener( container, update );
};
bindEvents();
};
var initAll = function() {
for( var i = 0, l = _toBuild.length; i < l; i++ ) {
_toBuild[i]();
}
};
MK.api.advancedgmaps = MK.api.advancedgmaps || function() {
initAll();
};
return {
init : function() {
_toBuild.push( build );
MK.core.loadDependencies(['https://maps.googleapis.com/maps/api/js?callback=MK.api.advancedgmaps']);
}
};
};
})(jQuery);
(function($) {
'use strict';
function mk_page_title_parallax() {
if (!MK.utils.isMobile() && mk_smooth_scroll !== 'false') {
$('.mk-effect-wrapper').each(function() {
var $this = $(this),
progressVal,
currentPoint,
ticking = false,
scrollY = MK.val.scroll(),
$window = $(window),
windowHeight = $(window).height(),
parentHeight = $this.outerHeight(),
startPoint = 0,
endPoint = $this.offset().top + parentHeight,
effectLayer = $this.find('.mk-effect-bg-layer'),
gradientLayer = effectLayer.find('.mk-effect-gradient-layer'),
cntLayer = $this.find('.mk-page-title-box-content'),
animation = effectLayer.attr('data-effect'),
top = $this.offset().top,
height = $this.outerHeight();
var parallaxSpeed = 0.7,
zoomFactor = 1.3;
var parallaxTopGap = function() {
var gap = top * parallaxSpeed;
effectLayer.css({
height : height + gap + 'px',
top : (-gap) + 'px'
});
};
if (animation == ("parallax" || "parallaxZoomOut") ) {
parallaxTopGap();
}
var animationSet = function() {
scrollY = MK.val.scroll();
if (animation == "parallax") {
currentPoint = (startPoint + scrollY) * parallaxSpeed;
effectLayer.get(0).style.transform = 'translateY(' + currentPoint + 'px)';
}
if (animation == "parallaxZoomOut") {
console.log(effectLayer);
currentPoint = (startPoint + scrollY) * parallaxSpeed;
progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint));
var zoomCalc = zoomFactor - ((zoomFactor - 1) * progressVal);
effectLayer.get(0).style.transform = 'translateY(' + currentPoint + 'px) scale(' + zoomCalc + ')';
}
if (animation == "gradient") {
progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint));
gradientLayer.css({
opacity: progressVal * 2
});
}
if (animation != "gradient") {
progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint));
cntLayer.css({
opacity: 1 - (progressVal * 4)
});
}
// Stop ticking
ticking = false;
};
animationSet();
// This will limit the calculation of the background position to
// 60fps as well as blocking it from running multiple times at once
var requestTick = function() {
if (!ticking) {
window.requestAnimationFrame(animationSet);
ticking = true;
}
};
$window.off('scroll', requestTick);
$window.on('scroll', requestTick);
});
}
}
var $window = $(window);
var debounceResize = null;
$window.on('load', mk_page_title_parallax);
$window.on("resize", function() {
if( debounceResize !== null ) { clearTimeout( debounceResize ); }
debounceResize = setTimeout( mk_page_title_parallax, 300 );
});
}(jQuery));
(function($) {
'use strict';
/* Page Section Intro Effects */
/* -------------------------------------------------------------------- */
function mk_section_intro_effects() {
if ( !MK.utils.isMobile() ) {
if($.exists('.mk-page-section.intro-true')) {
$('.mk-page-section.intro-true').each(function() {
var that = this;
MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.sectiontrans.js', MK.core.path.plugins + 'tweenmax.js' ], function() {
var $this = $(that),
$pageCnt = $this.nextAll('div'),
windowHeight = $(window).height(),
effectName = $this.attr('data-intro-effect'),
$header = $('.mk-header');
var effect = {
fade : new TimelineLite({paused: true})
.set($pageCnt, { opacity: 0, y: windowHeight * 0.3 })
.to($this, 1, { opacity: 0, ease:Power2.easeInOut })
.to($pageCnt, 1, { opacity: 1, y: 0, ease:Power2.easeInOut}, "-=.7")
.set($this, { zIndex: '-1'}),
zoom_out : new TimelineLite({paused: true})
.set($pageCnt, { opacity: 0, y: windowHeight * 0.3})
.to($this, 1.5, { opacity: .8, scale: 0.8, y: -windowHeight - 100, ease:Strong.easeInOut })
.to($pageCnt, 1.5, { opacity: 1, y: 0, ease:Strong.easeInOut}, "-=1.3"),
shuffle : new TimelineLite({paused: true})
.to($this, 1.5, { y: -windowHeight/2, ease:Strong.easeInOut })
.to($this.nextAll('div').first(), 1.5, { paddingTop: windowHeight/2, ease:Strong.easeInOut }, "-=1.3")
};
$this.sectiontrans({
effect : effectName
});
if($this.hasClass('shuffled')) {
TweenLite.set($this, { y: -windowHeight/2 });
TweenLite.set($this.nextAll('div').first(), { paddingTop: windowHeight/2 });
}
$('body').on('page_intro', function() {
MK.utils.scroll.disable();
$(this).data('intro', true);
effect[effectName].play();
setTimeout(function() {
$header.addClass('pre-sticky');
$header.addClass('a-sticky');
$('.mk-header-padding-wrapper').addClass('enable-padding');
$('body').data('intro', false);
if(effectName === 'shuffle') $this.addClass('shuffled');
}, 1000);
setTimeout(MK.utils.scroll.enable, 1500);
});
$('body').on('page_outro', function() {
MK.utils.scroll.disable();
$(this).data('intro', true);
effect[effectName].reverse();
setTimeout(function() {
$header.removeClass('pre-sticky');
$header.removeClass('a-sticky');
$('.mk-header-padding-wrapper').removeClass('enable-padding');
$('body').data('intro', false);
if($this.hasClass('shuffled')) $this.removeClass('shuffled');
}, 1000);
setTimeout(MK.utils.scroll.enable, 1500);
});
});
});
}
} else {
$('.mk-page-section.intro-true').each(function() {
$(this).attr('data-intro-effect', '');
});
}
}
mk_section_intro_effects();
var debounceResize = null;
$(window).on("resize", function() {
if( debounceResize !== null ) { clearTimeout( debounceResize ); }
debounceResize = setTimeout( mk_section_intro_effects, 300 );
});
}(jQuery));
/* mk_blog_teaser */
/* vc_row_inner */
/* mk_custom_box */
(function($) {
'use strict';
function mk_animated_cols() {
function equalheight (container){
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(container).each(function() {
$el = $(this);
$($el).height('auto');
topPosition = $el.position().top;
if (currentRowStart != topPosition) {
for (var currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
rowDivs.length = 0; // empty the array
currentRowStart = topPosition;
currentTallest = $el.height();
rowDivs.push($el);
} else {
rowDivs.push($el);
currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
}
for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
rowDivs[currentDiv].height(currentTallest);
}
});
// console.log('recalc' + container + ' ' + currentTallest);
return currentTallest;
}
function prepareCols(el) {
var $this = el.parent().parent().find('.mk-animated-columns');
var iconHeight = equalheight('.vc_row .animated-column-icon, .animated-column-holder .mk-svg-icon'),
titleHeight = equalheight('.vc_row .animated-column-title'),
descHeight = equalheight('.vc_row .animated-column-desc'),
btnHeight = $this.find('.animated-column-btn').innerHeight();
if ($this.hasClass('full-style')) {
$this.find('.animated-column-item').each(function() {
var $this = $(this),
contentHeight = (iconHeight + 30) + (titleHeight + 10) + (descHeight + 70) + 34;
$this.height(contentHeight * 1.5 + 50);
var $box_height = $this.outerHeight(true),
$icon_height = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height();
$this.find('.animated-column-holder').css({
'paddingTop': $box_height / 2 - $icon_height
});
$this.animate({opacity:1}, 300);
});
} else {
$this.find('.animated-column-item').each(function() {
var $this = $(this),
halfHeight = $this.height() / 2,
halfIconHeight = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height()/2,
halfTitleHeight = $this.find('.animated-column-simple-title').height()/2;
$this.find('.animated-column-holder').css({
'paddingTop': halfHeight - halfIconHeight
});
$this.find('.animated-column-title').css({
'paddingTop': halfHeight - halfTitleHeight
});
$this.animate({
opacity:1
}, 300);
});
}
}
$('.mk-animated-columns').each(function() {
var that = this;
MK.core.loadDependencies([ MK.core.path.plugins + 'tweenmax.js' ], function() {
var $this = $(that),
$parent = $this.parent().parent(),
$columns = $parent.find('.column_container'),
index = $columns.index($this.parent());
// really bad that we cannot read it before bootstrap - needs full shortcode refactor
if($this.hasClass('full-style')) {
$this.find('.animated-column-item').hover(
function() {
TweenLite.to($(this).find(".animated-column-holder"), 0.5, {
top: '-15%',
ease: Back.easeOut
});
TweenLite.to($(this).find(".animated-column-desc"), 0.5, {
top: '50%',
ease: Expo.easeOut
}, 0.4);
TweenLite.to($(this).find(".animated-column-btn"), 0.3, {
top: '50%',
ease: Expo.easeOut
}, 0.6);
},
function() {
TweenLite.to($(this).find(".animated-column-holder"), 0.5, {
top: '0%',
ease: Back.easeOut, easeParams:[3]
});
TweenLite.to($(this).find(".animated-column-desc"), 0.5, {
top: '100%',
ease: Back.easeOut
}, 0.4);
TweenLite.to($(this).find(".animated-column-btn"), 0.5, {
top: '100%',
ease: Back.easeOut
}, 0.2);
});
}
if($this.hasClass('simple-style')) {
$this.find('.animated-column-item').hover(
function() {
TweenLite.to($(this).find(".animated-column-holder"), 0.7, {
top: '100%',
ease: Expo.easeOut
});
TweenLite.to($(this).find(".animated-column-title"), 0.7, {
top: '0%',
ease: Back.easeOut
}, 0.2);
},
function() {
TweenLite.to($(this).find(".animated-column-holder"), 0.7, {
top: '0%',
ease: Expo.easeOut
});
TweenLite.to($(this).find(".animated-column-title"), 0.7, {
top: '-100%',
ease: Back.easeOut
}, 0.2);
});
}
if($columns.length === index + 1) {
prepareCols($this);
$(window).on("resize", function() {
setTimeout(prepareCols($this), 1000);
});
}
MK.utils.eventManager.subscribe('iconsInsert', function() {
prepareCols($this);
});
});
});
}
$(window).on('load', mk_animated_cols);
}(jQuery));
/* mk_divider */
/* mk_fancy_title */
/* mk_padding_divider */
/* vc_column_text */
/* mk_image */
/* mk_portfolio */
(function($) {
'use strict';
var zIndex = 0;
$('.mk-newspaper-wrapper').on('click', '.blog-loop-comments', function (event) {
event.preventDefault();
var $this = $(event.currentTarget);
var $parent = $this.parents('.mk-blog-newspaper-item');
$parent.css('z-index', ++zIndex);
$this.parents('.newspaper-item-footer').find('.newspaper-social-share').slideUp(200).end().find('.newspaper-comments-list').slideDown(200);
setTimeout( function() {
MK.utils.eventManager.publish('item-expanded');
}, 300);
});
$('.mk-newspaper-wrapper').on('click', '.newspaper-item-share', function (event) {
event.preventDefault();
var $this = $(event.currentTarget);
var $parent = $this.parents('.mk-blog-newspaper-item');
$parent.css('z-index', ++zIndex);
$this.parents('.newspaper-item-footer').find('.newspaper-comments-list').slideUp(200).end().find('.newspaper-social-share').slideDown(200);
setTimeout( function() {
MK.utils.eventManager.publish('item-expanded');
}, 300);
});
}(jQuery));
/* vc_column */
(function ($) {
'use strict';
function dynamicHeight() {
var $this = $( this );
$this.height( 'auto' );
if( window.matchMedia( '(max-width: 768px)' ).matches ) {
return;
}
$this.height( $this.height() );
}
var $window = $( window );
var container = document.getElementById( 'mk-theme-container' );
$( '.equal-columns' ).each( function() {
dynamicHeight.bind( this );
$window.on( 'load', dynamicHeight.bind( this ) );
$window.on( 'resize', dynamicHeight.bind( this ) );
window.addResizeListener( container, dynamicHeight.bind( this ) );
});
}( jQuery ));
(function( $ ) {
'use strict';
// If we want to get access to API of already initilised component we run a regular new conctructor.
// When instance is discovered in cache object then we return exisiting instance.
//
// TODO move it to core functions and run logic on init
var _instancesCollection = {};
MK.component.SwipeSlideshow = function( el ) {
var $this = $( el );
var id = $this.parent().attr('id');
this.el = el;
this.id = id;
this.config = $this.data( 'swipeslideshow-config' );
if( this.config ) this.config.hasPagination = false;
};
MK.component.SwipeSlideshow.prototype = {
init : function() {
var slider = new MK.ui.Slider( this.el, this.config );
slider.init();
_instancesCollection[ this.id ] = slider;
}
};
// Additional nav
// Mostly for thumbs in woocommerce
MK.component.SwipeSlideshowExtraNav = function( el ) {
this.el = el;
};
MK.component.SwipeSlideshowExtraNav.prototype = {
init : function init() {
this.cacheElements();
this.bindEvents();
},
cacheElements : function cacheElements() {
var $this = $( this.el );
this.sliderId = $this.data( 'gallery' );
this.slider = _instancesCollection[this.sliderId]; // convert to js obj
this.$thumbs = $( '#' + this.sliderId ).find( '.thumbnails a');
},
bindEvents : function bindEvents() {
this.$thumbs.on( 'click', this.clickThumb.bind( this ) );
},
clickThumb : function clickThumb( e ) {
e.preventDefault();
var $this = $( e.currentTarget ),
id = $this.index();
this.slider.goTo( id );
}
};
// Mostly for switcher in woocommerce
MK.utils.eventManager.subscribe('gallery-update', function(e, config) {
if(typeof _instancesCollection[config.id] === 'undefined') return;
_instancesCollection[config.id].reset();
});
})( jQuery );
/* mk_audio */
/* mk_button */
/* mk_milestone */
/* mk_flipbox */
/* mk_imagebox */
/* mk_imagebox_item */