/** ***************************************************************************************** ** CONTENT BOXES BLOCK ********************************************************************** *********************************************************************************************/ ( function( jQuery ) { 'use strict'; function cbinit() { /* remove links from backend content boxes */ jQuery('.editor-styles-wrapper .contentboxes-wrap a').removeAttr("href"); /* fix margins */ jQuery( ".subtitle-above" ).next().css( "margin-top", "12px" ); // RTL if (jQuery('body').hasClass("rtl")) { var rtlorigin = false; } else { var rtlorigin = true; } var jQuerycontentboxesgrid = jQuery('.contentboxes-masonry'); jQuerycontentboxesgrid.imagesLoaded( function() { jQuerycontentboxesgrid.masonry({ percentPosition: true, isOriginLeft: rtlorigin }); }); // content box one third and two third round numbers var contentboxeswidth = jQuery(".contentboxes-masonry").width(); var onethirdwidth = contentboxeswidth / 3; var onethirdwidthround = Math.round(onethirdwidth); var twothirdwidthround = onethirdwidthround * 2; jQuery('.contentboxes-image-wrap.one-third-width').each(function(){ jQuery(this).css( "width" , onethirdwidthround ); }); jQuery('.contentboxes-image-wrap.two-third-width').each(function(){ jQuery(this).css( "width" , twothirdwidthround ); }); //content boxes height - square jQuery('.contentboxes-image-wrap.square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half jQuery('.contentboxes-image-wrap.half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - portrait jQuery('.contentboxes-image-wrap.one-and-a-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width() - 24; if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - portrait high jQuery('.contentboxes-image-wrap.double-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').height(); var doubleheight = boxheight / 2; var boxwidth = jQuery(this).width() - 24; if (doubleheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (doubleheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); /* resizing */ jQuery(window).on('load',CBsizeContent); jQuery(window).on('resize',CBsizeContent); function CBsizeContent() { var windowWidth = jQuery(window).width(); var windowHeight = jQuery(window).height(); var topbarHeight = jQuery(".topbar").height(); var headerHeight = jQuery("header").height(); var viewheight = windowHeight - topbarHeight - headerHeight + 24; /* 100% vh of content boxes */ if (windowWidth < 960) { jQuery('.contentboxes-image-wrap.no-content.mobile-viewheight, .contentboxes-image-wrap.has-content.mobile-viewheight').each(function(){ jQuery(this).css( "height" , viewheight ); }); } // content box one third and two third round numbers var contentboxeswidth = jQuery(".contentboxes-masonry").width(); var onethirdwidth = contentboxeswidth / 3; var onethirdwidthround = Math.round(onethirdwidth); var twothirdwidthround = onethirdwidthround * 2; jQuery('.contentboxes-image-wrap.one-third-width').each(function(){ jQuery(this).css( "width" , onethirdwidthround ); }); jQuery('.contentboxes-image-wrap.two-third-width').each(function(){ jQuery(this).css( "width" , twothirdwidthround ); }); //content boxes height - 100% (square) jQuery('.contentboxes-image-wrap.square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half 50% (landscape) jQuery('.contentboxes-image-wrap.half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - half 75% (landscape high) jQuery('.contentboxes-image-wrap.three-quarter-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var threequarterboxheight = boxheight * 1.34; var boxwidth = jQuery(this).width(); if (threequarterboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (threequarterboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - 150% (portrait) jQuery('.contentboxes-image-wrap.one-and-a-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width() - 24; if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); //content boxes height - 200% (portrait high) jQuery('.contentboxes-image-wrap.double-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var doubleheight = boxheight / 2; var boxwidth = jQuery(this).width(); if (doubleheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (doubleheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); /* RESPONSIVE RESIZING */ if (windowWidth < 1200) { //content boxes height - portrait jQuery('.contentboxes-image-wrap.quarter-width.double-height.has-content').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var oneandahalfheight = boxheight / 1.5; var boxwidth = jQuery(this).width(); if (oneandahalfheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (oneandahalfheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); } if (windowWidth < 960) { //content boxes height mobile - square jQuery('.contentboxes-image-wrap.mobile-square').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var boxwidth = jQuery(this).outerWidth() ; if (boxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height centered-content' ); } else if (boxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height centered-content' ); } }); //content boxes height - half jQuery('.contentboxes-image-wrap.mobile-half-height').each(function(){ var boxheight = jQuery(this).find('.contentboxes-content').outerHeight(); var halfboxheight = boxheight * 2; var boxwidth = jQuery(this).width(); if (halfboxheight < boxwidth ) { jQuery(this).addClass( 'use-defined-height' ); } else if (halfboxheight > boxwidth) { jQuery(this).removeClass( 'use-defined-height'); } }); } } } jQuery( document ).ready( cbinit ); jQuery( document ).on( 'mb_blocks_preview/contentboxes', cbinit ); } )( jQuery ); /** ***************************************************************************************** ** HERO BLOCK **************************************************************************** *********************************************************************************************/ ( function( jQuery ) { 'use strict'; function cbinit() { jQuery(window).on('load',sizeContentHero); jQuery(window).on('resize',sizeContentHero); jQuery(document).on('mb_blocks_preview/hero-image',sizeContentHero); jQuery('.section-hero').on('mb_blocks_preview/hero-video',sizeContentHero); function sizeContentHero() { var windowWidth = jQuery(window).width(); var windowHeight = jQuery(window).height(); var topbarHeight = jQuery(".topbar").height(); var headerHeight = jQuery("header").height(); var viewheight = windowHeight - topbarHeight - headerHeight; console.log('window height = ' + windowHeight); console.log('top bar height = ' + topbarHeight); console.log('header height = ' + headerHeight); console.log('view height = ' + viewheight); /* 100% vh of hero image block */ jQuery('.full-viewheight .hero-image').each(function(){ jQuery(this).css( "min-height" , viewheight ); }); if (windowWidth < 960) { jQuery('.full-viewheightmobile .hero-image').each(function(){ jQuery(this).css( "min-height" , viewheight ); }); } jQuery('.section-hero').each(function(){ var imageheight = jQuery(this).find('.hero-background').outerHeight(); var contentheight = jQuery(this).find('.hero-content').outerHeight(); if (contentheight > imageheight ) { jQuery(this).find('.hero-background').css( "height" , contentheight ); } else if (imageheight > contentheight ) { jQuery(this).find('.hero-background').css( "height" , '' ); } }); /* 100% vh of hero video block */ jQuery('.full-viewheight .hero-bgvideo-wrap').each(function(){ jQuery(this).find('.hero-bgvideo').css( "min-height" , viewheight ); var contentheight = jQuery(this).find('.hero-content').outerHeight(); if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , contentheight ); } else if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , viewheight ); } }); if (windowWidth < 960) { jQuery('.full-viewheightmobile .hero-bgvideo-wrap').each(function(){ jQuery(this).find('.hero-bgvideo').css( "min-height" , viewheight ); var contentheight = jQuery(this).find('.hero-content').outerHeight(); if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , contentheight ); } else if (contentheight > viewheight ) { jQuery(this).find('.hero-bgvideo').css( "max-height" , viewheight ); } }); } } // Tooltip jQuery( document ).on( 'mb_blocks_preview/hero-image', function( e ) { var herocontent = jQuery(e.target ).find('.hero-content'); jQuery( herocontent ).append( "