Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery.fn.prettyPhoto = function() {
- return false;
- };
- (function($){
- "use strict";
- $.expr[':'].notparents = function(a,i,m){
- return $(a).parents(m[3]).length < 1;
- };
- $.expr[':'].parents = function(a,i,m){
- return $(a).parents(m[3]).length == 1;
- };
- var MOOD = window.MOOD || {};
- MOOD.guidGenerator = function() {
- var S4 = function() {
- return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
- };
- return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
- };
- MOOD.isElementInViewport = function(el, off) {
- if (typeof jQuery === "function" && el instanceof jQuery) {
- el = el[0];
- }
- off = typeof off=='undefined' ? 50 : off;
- var rect = el.getBoundingClientRect();
- return (
- (
- ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
- ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
- ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
- )
- );
- };
- MOOD.isBelowViewport = function(el, off) {
- if (typeof jQuery === "function" && el instanceof jQuery) {
- el = el[0];
- }
- off = typeof off=='undefined' ? 0 : off;
- var rect = el.getBoundingClientRect();
- //console.log(rect.bottom, off, window.innerHeight, document.documentElement.clientHeight);
- return ( ( rect.bottom + off ) <= (window.innerHeight || document.documentElement.clientHeight) );
- };
- MOOD.smoothScroll = function() {
- var $body = $('body'),
- $html = $('html'),
- stopWP = false;
- if(window.location.hash) {
- stopWP = true;
- setTimeout(function() {
- window.scrollTo(0, 0);
- }, 1);
- $(window).on('load', function(){
- $body.add($html).animate({scrollTop: 0}, 1);
- setTimeout(function(){
- var target = $(window.location.hash),
- start = parseFloat($(window).scrollTop());
- target = target.length && target || $('[name="' + window.location.hash.slice(1) +'"]');
- if (target.length) {
- var targetOffset = target.offset().top,
- time = Math.abs(targetOffset-start) < 100 ? 100 : Math.abs(targetOffset-start);
- time = time > 1000 ? 1000 : time;
- $body.add($html).animate({scrollTop: targetOffset}, time, 'easeInOutQuad', function(){
- stopWP = false;
- });
- }
- }, 500);
- });
- }
- var current_href = document.location.href.replace(window.location.hash,''),
- $navDots = $( '<div class="mood-vert-nav-dots" />' );
- if ( $('.mood-vert-nav-ph').length ) {
- $body.append( $navDots );
- }
- var waypoints = $('.mood-vert-nav-ph').each(function(){
- var $section = $(this),
- id = $section.attr('id'),
- label = $section.attr('data-label'),
- firstID = $('.mood-vert-nav-ph').eq(0).attr('id');
- if ( id == firstID )
- id = 'page_holder';
- $navDots.append('<div class="mood-vert-nav-dot" data-target="' + id + '"><a class="pixscroll" href="#' + id + '"><span class="mood-vert-nav-tooltip">' + label + '</span></a></div>');
- $section.waypoint(function(direction) {
- if ( direction === 'down' ) {
- if ( !stopWP )
- window.history.replaceState( false, false, current_href + '#' + id );
- $('.mood-vert-nav-dot').removeClass('selected');
- $('.mood-vert-nav-dot[data-target="' + id + '"]').addClass('selected');
- }
- }, {
- offset: '1'
- });
- $section.waypoint(function(direction) {
- if ( direction === 'up' ) {
- if ( !stopWP )
- window.history.replaceState( false, false, current_href + '#' + id );
- $('.mood-vert-nav-dot').removeClass('selected');
- $('.mood-vert-nav-dot[data-target="' + id + '"]').addClass('selected');
- }
- }, {
- offset: '-1'
- });
- });
- var waypoints2 = $('#nav-wrap a[href^="#"]').each(function(){
- var $link = $(this),
- target = $link.attr('href'),
- id = target.substr(0,target.indexOf('#'));
- if ( ! $('#nav-wrap li.current-menu-item').length && $('#nav-wrap a[href^="#"]').length > 1 && target != '#' )
- $('#nav-wrap li').has('a').eq(0).addClass('current-menu-item');
- if ( target != '#' ) {
- $('.vc_row' + target).waypoint(function(direction) {
- if ( direction === 'down' ) {
- if ( !stopWP )
- window.history.replaceState( false, false, current_href + target );
- $('#nav-wrap li').removeClass('current-menu-item');
- $link.parents('li').eq(0).addClass('current-menu-item');
- }
- }, {
- offset: '1'
- });
- $('.vc_row' + target).waypoint(function(direction) {
- if ( direction === 'up' ) {
- if ( !stopWP )
- window.history.replaceState( false, false, current_href + target );
- $('#nav-wrap li').removeClass('current-menu-item');
- $link.parents('li').eq(0).addClass('current-menu-item');
- }
- }, {
- offset: '-1'
- });
- }
- });
- if( !window.location.hash )
- $('.mood-vert-nav-dots .mood-vert-nav-dot').eq(0).addClass('selected');
- $('a.pixscroll[href^="#"], .pixscroll > a[href^="#"], #nav-wrap a[href^="#"], .mood-button-wrap a[href^="#"], .woocommerce-review-link[href^="#"]').on('click',function(e) {
- e.preventDefault();
- var $el = $(this),
- runFunc = function(){
- $el.each(function(){
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
- var target = $(this.hash),
- start = parseFloat($(window).scrollTop());
- target = target.length && target || $('[name=' + this.hash.slice(1) +']');
- if (target.length) {
- var targetOffset = target.offset().top,
- time = Math.abs(targetOffset-start) < 100 ? 100 : Math.abs(targetOffset-start);
- time = time > 1000 ? 1000 : time;
- $body.add($html).stop(true, false).animate({scrollTop: targetOffset}, time, 'easeOutQuad');
- }
- }
- });
- };
- if ( $el.attr('href').slice(-1)!='#' ) {
- if ( $el.hasClass('woocommerce-review-link') ) {
- $('a[href="#tab-reviews"]').click();
- }
- var set = setTimeout(runFunc, 10);
- }
- });
- $(window).on('isotoped', function(){
- Waypoint.refreshAll();
- });
- $('.vc-row-mood-scroll-down').on('click',function(e) {
- e.preventDefault();
- var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop,
- winH = $(window).height() - 100;
- $body.add($html).stop(true, false).animate({scrollTop: ( scrollTop + winH )}, 750, 'easeOutQuad');
- });
- $('a[href="#"]').on('click',function(e) {
- e.preventDefault();
- });
- };
- MOOD.mainNavigation = function() {
- var $elements = $('#nav-wrap nav#site-navigation > div > ul > li, #header-cart, .wpml_custom_language_top_selector');
- if ( $('body').hasClass('mood-overlay-menu') )
- $elements = $('#header-cart, .wpml_custom_language_top_selector');
- var checkPosition = function(el, el2, dir, off) {
- dir = typeof dir=='undefined' || dir==='' ? 'hor' : dir;
- off = typeof off=='undefined' || off==='' ? 40 : parseFloat(off);
- var rect = el[0].getBoundingClientRect(),
- rect2;
- if ( dir == 'hor' )
- rect2 = el2[0].getBoundingClientRect();
- if ( dir == 'hor' && ( rect.right + off ) >= rect2.right ) {
- return parseFloat( ( rect.right + off ) - ( rect2.right ) ) * -1;
- } else if ( dir == 'ver' && ( rect.bottom + off*2 ) >= window.innerHeight ) {
- return parseFloat( ( rect.bottom + off*2 ) - ( window.innerHeight ) ) * -1;
- } else if ( dir == 'hor' && ( rect.left - off ) <= rect2.left ) {
- return parseFloat( ( rect.left - off ) - rect2.left ) * -1;
- }
- };
- $elements.find('a').on('touchstart', function(e){
- var $aThis = $(this);
- if ( $aThis.hasClass('touch_active') ) {
- $aThis.removeClass('touch_active');
- } else {
- if ( !$('body').hasClass('mobile-view') ) {
- e.preventDefault();
- $aThis.addClass('touch_active');
- }
- }
- });
- $elements.find('ul, > div').each(function(){
- var $el = $(this),
- $li = $el.parents('li').eq(0),
- $header = $('#header-wrap'),
- $container = $('#container');
- var moveSubmenu = function(){
- if ( ! $('body').hasClass('header-layout-side') ) {
- if ( $li.hasClass('wide_width') ) {
- var header_w = $header.width();
- $el.css({
- width: header_w
- });
- }
- if ( $el.is('ul') )
- $el.css({ marginLeft : 0 });
- else
- $el.css({ left : 0 });
- var move = checkPosition($el, $header);
- if ( move !== 0 && ( $el.hasClass('depth-0') || $el.is('div') || $elements.is('.wpml_custom_language_top_selector') ) ) {
- if ( $el.is('ul') ) {
- $el.css({ marginLeft : move });
- } else {
- $el.css({ left : move });
- }
- }
- if ( move < 0 ) {
- $el.addClass('reverse');
- }
- } else {
- if ( $li.hasClass('wide_width') ) {
- var cont_w = $container.width();
- $el.css({
- width: cont_w
- });
- }
- $el.css({ marginTop : 0 });
- var move = checkPosition($el, $(window), 'ver', 20);
- if ( move !== 0 ) {
- $el.css({
- marginTop: move
- });
- }
- }
- };
- moveSubmenu();
- var setCheckPosition;
- $(window).on( 'resize load', function(){
- clearTimeout(setCheckPosition);
- setCheckPosition = setTimeout( moveSubmenu, 150 );
- });
- $li.off('hover')
- .on('hover', function(){
- moveSubmenu();
- });
- });
- if ( ! $('body').hasClass('mood-overlay-menu') ) {
- $('#nav-wrap nav#site-navigation > div > ul > li.pix_megamenu').each(function(){
- var $el = $(this),
- el_W = $el.outerWidth(),
- $child = $el.find('> ul, > div:not(.mega_clear)'),
- off,
- offLayout,
- setResizeMegaMenu,
- resizeMegaMenu = function(){
- var wDiv = 0, wTemp = 0, colDiv = 0, colTemp = 0;
- $el.find('> div').attr('data-cols', 0).each(function(){
- if ( !$el.hasClass('wide_width') ) {
- $(this).css({width:'auto'});
- }
- $('> div > ul, > div.mega_clear', this).each(function(){
- if ($(this).hasClass('mega_clear')) {
- if ( wTemp < wDiv ) {
- wTemp = wDiv;
- }
- wDiv = 0;
- } else {
- var wDivEach = $(this).outerWidth();
- wDiv = wDiv + wDivEach;
- }
- });
- });
- if ( wTemp < wDiv ) {
- wTemp = wDiv;
- }
- if ( !$el.hasClass('wide_width') ) {
- $el.find('> div').width(wTemp);
- }
- $el.attr('data-width', wTemp);
- $el.find('> div').each(function(){
- $('> div > ul, > div.mega_clear', this).each(function(){
- if ($(this).hasClass('mega_clear')) {
- if ( colTemp < colDiv ) {
- colTemp = colDiv;
- }
- colDiv = 0;
- } else {
- var colDivEach = parseFloat($(this).attr('data-col'));
- colDiv = colDiv + colDivEach;
- }
- });
- });
- if ( colTemp < colDiv ) {
- colTemp = colDiv;
- }
- $el.find('> div').attr('data-cols', colTemp);
- el_W = $el.outerWidth();
- };
- resizeMegaMenu();
- $(window).on('pix_megamenu resize', function(){
- clearTimeout(setResizeMegaMenu);
- setResizeMegaMenu = setTimeout( resizeMegaMenu, 30 );
- });
- });
- }
- };
- MOOD.overlayMenu = function() {
- if ( !$('body').hasClass('mood-overlay-menu') )
- return false;
- var $burger = $('#hamburger-menu, #hamburger-menu-overlay'),
- $page = $('#page'),
- $overlay = $('#overlay-wrap'),
- $menu = $('#nav-wrap nav#site-navigation > div').not('#header-cart'),
- $arrow_icon = $('svg[data-id="left-7-icon"]'),
- $icons = $('#header-icons'),
- respW = typeof mood_mobile_menu_width !== 'undefined' && mood_mobile_menu_width !== '' ? mood_mobile_menu_width : 800,
- winW,
- check = 0,
- $titles = $('.pix_mega_title', $menu);
- $('> ul > li', $menu).each(function(){
- var $liMega = $(this),
- $ulMega = $('<ul class="ul-mega" />');
- if ( $liMega.has('> ul[data-col]') ) {
- $liMega.append( $ulMega );
- $('ul[data-col]', this).each(function(){
- $('> li', this).appendTo( $ulMega );
- $(this).remove();
- });
- }
- });
- $titles.each(function(){
- var $title = $(this),
- $li = $title.parents('li').eq(0),
- $until = $('li').has('.pix_mega_title'),
- $ul = $('<ul class="ul-mega-children" />');
- $li.nextUntil($until, 'li').each(function() {
- $ul.append($(this));
- });
- if ( $('li', $ul).length ) {
- $li.append( $ul );
- }
- });
- var checkRespoMenu = function(){
- winW = $(window).width();
- if ( $burger.hasClass('clicked') )
- $burger.removeClass('clicked');
- if ( $overlay.hasClass('open') )
- $overlay.removeClass('open');
- if ( winW <= respW ) {
- $('#menu-placeholder').before($menu);
- $icons.replaceWith( '<div id="header-icons">' + $icons.html() + '</div>' );
- $('#icons-placeholder').before($icons);
- } else if ( winW > respW ) {
- if ( !$('#menu-placeholder').length )
- $menu.after($('<span id="menu-placeholder" />'));
- if ( !$('#icons-placeholder').length )
- $icons.after($('<span id="icons-placeholder" />'));
- $menu.find('li').has('.pixmenu-wrap-level').each(function(){
- $(this)
- .find('.mega_clear').remove().end()
- .find('.pixmenu-wrap-level > div').unwrap().end()
- .find('.pixmenu-wrap-row > ul').unwrap();
- });
- $menu.find('li').has('ul').each(function(){
- if ( check == 0 ) {
- var $clone_arrow = $arrow_icon.clone();
- $(this).append('<span class="sub-overlay-back-arrow" />')
- .find('.sub-overlay-back-arrow').append( $clone_arrow );
- }
- });
- $menu.addClass('appended-menu');
- $overlay.append( $menu );
- if ( !$('> ul li#header-icons', $menu).length )
- $menu.find('> ul').append( $icons );
- $icons.replaceWith( '<li id="header-icons">' + $icons.html() + '</li>' );
- }
- check = 1;
- };
- checkRespoMenu();
- var setCheckMenu;
- $(window).on( 'resize mood-mobile-resize', function(){
- clearTimeout(setCheckMenu);
- setCheckMenu = setTimeout( checkRespoMenu, 30 );
- });
- $burger.on('click', function(e){
- if ( winW > respW ) {
- e.preventDefault();
- $burger.toggleClass('clicked');
- if ( $burger.hasClass('clicked') ) {
- $('html, body').addClass('overflow_hidden');
- $overlay.addClass('open').show().velocity("stop").velocity({
- opacity: 1,
- }, {
- duration: 500,
- delay: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- $menu.find('> ul > li:not(#header-icons), #header-icons a').velocity("stop").velocity('transition.slideUpIn', {
- delay: 350,
- duration: 500,
- stagger: 150,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- } else {
- $('html, body').removeClass('overflow_hidden');
- $menu.find('> ul > li:not(#header-icons), #header-icons a').velocity("stop").velocity('transition.slideUpOut', {
- duration: 250,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $menu.find('> ul > li:not(#header-icons), #header-icons a').show().css({
- opacity: 0
- });
- }
- });
- $overlay.velocity("stop").velocity({
- delay: 750,
- opacity: 0,
- }, {
- duration: 500,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $overlay.removeClass('open').hide();
- $('.sub-revealed', $menu).removeClass('sub-revealed');
- $('.sub-overlay-back-arrow', $menu).hide();
- $('li > a, li > .pix-menu-no-link', $menu).show().css({
- opacity: 1
- });
- $('li > ul, li > ul > li', $menu).hide();
- }
- });
- }
- $('li', $menu).has('> ul').each(function(){
- var $li = $(this),
- $a = $('> a, > .pix_mega_title, > .pix-menu-no-link', $li),
- $parent = $li.parents('li').eq(0),
- $parentUl = $li.parents('ul').eq(0),
- $arrow = $('> .sub-overlay-back-arrow', $li),
- $all = $li.siblings().not($icons);
- $a.off('click')
- .on('click', function(e){
- var $this = $(this);
- if ( ! $li.hasClass('sub-revealed') ) {
- e.preventDefault();
- $('> .sub-overlay-back-arrow', $parent).velocity("stop").velocity('transition.slideLeftOut', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- $li.add($all).add($parent).find(' > a, > .pix-menu-no-link').add('#header-icons a', $parentUl).velocity("stop").velocity('transition.slideUpOut', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $li.addClass('sub-revealed');
- $parent.removeClass('sub-revealed');
- $li.find('> ul').show().find('> li').add($this).show().velocity('transition.slideUpIn', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $arrow.velocity('transition.slideRightIn', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- }
- });
- }
- });
- }
- });
- $arrow.off('click')
- .on('click', function(e){
- $arrow.velocity("stop").velocity('transition.slideLeftOut', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $li.find('> ul > li').add($a).velocity("stop").velocity('transition.slideUpOut', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $li.removeClass('sub-revealed');
- $parent.addClass('sub-revealed');
- $li.add($all).find(' > a, > .pix-menu-no-link').add('> a', $parent).add('#header-icons a', $parentUl).show().velocity("stop").velocity('transition.slideUpIn', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $('> .sub-overlay-back-arrow', $parent).velocity("stop").velocity('transition.slideRightIn', {
- duration: 300,
- stagger: 50,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- }
- });
- }
- });
- }
- });
- });
- });
- }
- });
- };
- MOOD.searchOverlay = function(){
- var respW = typeof mood_mobile_menu_width !== 'undefined' && mood_mobile_menu_width !== '' ? mood_mobile_menu_width : 800,
- $win = $(window),
- $page = $('#page'),
- $search_icon = $('#top-search-icon'),
- $overlay = $('#top-search-form'),
- $overlay_menu = $('#overlay-wrap'),
- $input = $('input[type="search"]', $overlay),
- $close = $('#close-search-form', $overlay),
- $results,
- setResize,
- $search_holder = $('<div id="top-search-holder" />').hide(),
- $live_search = $('.searchwp-live-search-results'),
- $form = $('#top-search-form').after($search_holder);
- $('.form-wrap', $form).append($live_search);
- var setResultsH = function(){
- if ( !$('.searchwp-live-search-results').length )
- return false;
- var winH = $win.height(),
- $results = $('.searchwp-live-search-results'),
- topResults = $input.offset().top,
- topResultsH = $input.outerHeight(),
- resultsH = winH - ( topResults + topResultsH );
- $results.css({
- height: resultsH
- });
- };
- $search_icon.on('click', function(e){
- e.preventDefault();
- if ( $win.width() > mood_mobile_menu_width ) {
- $('html, body').addClass('overflow_hidden');
- if ( $('body').hasClass('mood-overlay-menu') && $overlay_menu.hasClass('open') ) {
- $overlay_menu.velocity("stop").velocity({
- opacity: 0
- }, {
- duration: 550,
- delay: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- }
- $overlay.show().velocity("stop").velocity({
- opacity: 1,
- }, {
- duration: 500,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- $input.velocity("stop").velocity({
- opacity: 1,
- translateY: [0, '100px'],
- rotateX: [0, '-90deg'],
- }, {
- duration: 550,
- delay: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function() {
- setResultsH();
- $input.focus();
- }
- });
- $close.velocity("stop").velocity(
- 'fadeIn', {
- duration: 550,
- delay: 450,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- }
- });
- $close.on('click', function(e){
- e.preventDefault();
- $close.velocity("stop").velocity(
- 'fadeOut', {
- duration: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- $input.velocity("stop").velocity({
- translateY: '50px',
- rotateX: ['90deg', 0]
- }, {
- duration: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $input.blur().css({
- opacity: 0
- });
- }
- });
- $overlay.velocity("stop").velocity({
- opacity: 0,
- }, {
- duration: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $overlay.hide();
- $('html, body').removeClass('overflow_hidden');
- }
- });
- if ( $('body').hasClass('mood-overlay-menu') && $overlay_menu.hasClass('open') ) {
- $overlay_menu.velocity("stop").velocity({
- opacity: 1
- }, {
- duration: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ]
- });
- }
- });
- $(window).on('resize', function(){
- clearTimeout(setResize);
- setResize = setTimeout(setResultsH,10);
- });
- };
- MOOD.stickyNav = function(){
- var $header = $('header#masthead'),
- $nav = $('#nav-wrap'),
- $body = $('body'),
- mastheadHeight = parseFloat($header.attr('data-height'));
- var lastScrollTop = 0,
- delta = 60;
- var detect_position = function () {
- var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop,
- new_scroll = window.pageYOffset + document.documentElement.scrollTop,
- window_h = $(window).height();
- if( Math.abs(lastScrollTop - new_scroll) >= delta ) {
- if ( new_scroll > lastScrollTop ){
- $body.addClass('scrollingDown');
- if ( new_scroll > mastheadHeight * 2 ) {
- if ( !$body.hasClass('sticky-reached') ) {
- $body.addClass('sticky-reached');
- }
- }
- } else {
- $body.removeClass('scrollingDown');
- if ( $body.hasClass('sticky-reached') ) {
- $body.removeClass('sticky-menu');
- }
- if ( new_scroll <= mastheadHeight * 2 ) {
- if ( $body.hasClass('sticky-reached') ) {
- $body.removeClass('sticky-reached');
- }
- }
- }
- lastScrollTop = new_scroll;
- }
- if ( new_scroll > 10 )
- $body.addClass('scrolled-down');
- else
- $body.removeClass('scrolled-down');
- if ( new_scroll > ( window_h * 0.75 ) )
- $body.addClass('scroll-top-reached');
- else
- $body.removeClass('scroll-top-reached');
- };
- detect_position();
- function onScroll(evt) {
- requestAnimFrame(detect_position);
- //detect_position();
- }
- // shim layer with setTimeout fallback
- window.requestAnimFrame = (function() {
- return window.requestAnimationFrame ||
- window.webkitRequestAnimationFrame ||
- window.mozRequestAnimationFrame ||
- window.oRequestAnimationFrame ||
- window.msRequestAnimationFrame ||
- function(callback) {
- window.setTimeout(callback, 1000 / 60);
- };
- })();
- window.addEventListener('scroll', onScroll, false);
- window.addEventListener('resize', onScroll, false);
- onScroll();
- };
- MOOD.mobileMenu = function(){
- var respW = typeof mood_mobile_menu_width !== 'undefined' && mood_mobile_menu_width !== '' ? mood_mobile_menu_width : 800,
- $window = $(window),
- $burger = $('#hamburger-menu'),
- $header = $('header#masthead'),
- $menu_cont = $('.main-menu-container').after('<span id="menu-container-placeholder" />'),
- $cart = $('#header-cart').after('<span id="header-cart-placeholder" />'),
- $search = $('#header-search').after('<span id="header-search-placeholder" />'),
- $social = $('#nav-social').after('<span id="nav-social-placeholder" />'),
- $ph_menu = $('#menu-container-placeholder'),
- $ph_cart = $('#header-cart-placeholder'),
- $ph_search = $('#header-search-placeholder'),
- $ph_social = $('#nav-social-placeholder'),
- $topbar = $('#header-topbar').after('<span id="topbar-placeholder" />'),
- $ph_topbar = $('#topbar-placeholder'),
- $search_form = $('#top-search-form .form-wrap').after('<span id="form-placeholder" />'),
- $ph_search_form = $('#form-placeholder'),
- winW,
- winWCheck = 0,
- $titles = $('.pix_mega_title', $menu_cont);
- var checkRespoMenu = function(){
- winW = $window.width();
- if ( winW == winWCheck ) return false;
- if ( winW <= respW ) {
- if ( !$('body').hasClass('mood-overlay-menu') ) {
- $titles.each(function(){
- var $title = $(this),
- $li = $title.parents('li').eq(0),
- $until = $('li').has('.pix_mega_title'),
- $ul = $('<ul class="ul-mega-children" />');
- $li.nextUntil($until, 'li').each(function() {
- $ul.append($(this));
- });
- if ( $('li', $ul).length ) {
- $li.append( $ul );
- }
- });
- }
- $('body').addClass('mobile-view');
- if ( $('body').hasClass('transparent-header') ) {
- $('body').removeClass('transparent-header').addClass('nomore-transparent-header');
- }
- if ( $('body').hasClass('header-layout-wide-centered') ) {
- $('body').removeClass('header-layout-wide-centered').addClass('nomore-header-layout-wide-centered');
- }
- if ( $('body').hasClass('header-layout-side') ) {
- $('body').removeClass('header-layout-side').addClass('nomore-header-layout-side');
- }
- if ( $menu_cont.hasClass('appended-menu') ) {
- $menu_cont.removeClass('appended-menu').addClass('nomore-appended-menu');
- }
- $search.append($search_form);
- $menu_cont.append($cart).append($search).append($topbar).append($social);
- $header.after($menu_cont);
- } else {
- if ( !$('body').hasClass('mood-overlay-menu') ) {
- $titles.each(function(){
- var $parent = $(this).parents('li').eq(0);
- if ( $parent.has('.ul-mega-children') ) {
- var $ulMega = $('.ul-mega-children', $parent);
- $($(' > li', $ulMega).get().reverse()).each(function(){
- var $li = $(this);
- $parent.after($li);
- });
- $ulMega.remove();
- }
- });
- }
- $menu_cont.find('[style*="display: none"]').each(function(){
- $(this).show();
- });
- $('body').removeClass('mobile-view');
- if ( $('body').hasClass('nomore-transparent-header') ) {
- $('body').removeClass('nomore-transparent-header').addClass('transparent-header');
- }
- if ( $('body').hasClass('nomore-header-layout-wide-centered') ) {
- $('body').removeClass('nomore-header-layout-wide-centered').addClass('header-layout-wide-centered');
- }
- if ( $('body').hasClass('nomore-header-layout-side') ) {
- $('body').removeClass('nomore-header-layout-side').addClass('header-layout-side');
- }
- if ( $menu_cont.hasClass('nomore-appended-menu') ) {
- $menu_cont.removeClass('nomore-appended-menu').addClass('appended-menu');
- }
- $ph_menu.before($menu_cont);
- $ph_cart.before($cart);
- $ph_search.before($search);
- $ph_social.before($social);
- $ph_topbar.before($topbar);
- $ph_search_form.before($search_form);
- setTimeout( function(){
- $(window).trigger('mood-mobile-resize');
- }, 30 );
- }
- var $li_mega_menu = $('li', $menu_cont).has('ul.ul-mega-children').find('> .pix-menu-no-link, > a');
- $('li.menu-item-has-children > a, li.menu-item-has-children > .pix-menu-no-link, .ul-mega > li > .pix_mega_title', $menu_cont).add($li_mega_menu).each(function(){
- var $menu_a = $(this),
- $li = $menu_a.parents('li').eq(0),
- $li_parent = $li.parents('li').eq(0),
- $ul = $('> ul, > div', $li),
- $ul_parent = $li.parents('ul').eq(0),
- $ul_siblings = $ul_parent.siblings('[data-col]'),
- $divs = $ul_parent.siblings('div'),
- $siblings = $li.siblings();
- if ( ! $( '.after', $menu_a ).length )
- $menu_a.append('<span class="after" />');
- var $after = $('> .after', $menu_a);
- $after.off('click');
- $after.on('click', function(e){
- e.stopPropagation();
- e.preventDefault();
- $menu_a.toggleClass('clicked');
- /*if ( $menu_a.hasClass('clicked') ) {
- $siblings.add('> a, > .pix-menu-no-link, > .pix_mega_title', $li_parent).add('> a', $divs).velocity("stop").velocity( 'slideUp', { duration: 500 });
- $ul.velocity("stop").velocity( 'slideDown', { duration: 500 });
- } else {
- $ul.velocity("stop").velocity( 'slideUp', { duration: 500 });
- $siblings.add('> a', $li_parent).add('> a', $divs).velocity("stop").velocity( 'slideDown', { duration: 500, display: 'block' });
- }*/
- if ( $menu_a.hasClass('clicked') ) {
- $siblings.add('> a, > .pix-menu-no-link, > .pix_mega_title', $li_parent).add('> a', $divs).add($ul_siblings).stop(true, false).slideUp(500);
- $ul.stop(true, false).slideDown(500);
- } else {
- $ul.stop(true, false).slideUp(500);
- $siblings.add('> a', $li_parent).add('> a', $divs).add($ul_siblings).stop(true, false).slideDown(500);
- }
- });
- });
- $('li > span.wpml-native-name', $menu_cont).each(function(){
- var $menu_a = $(this),
- $topbar = $('#header-topbar'),
- $li = $menu_a.parents('li').eq(0),
- $el = $li.parents('.top-bar-element').eq(0),
- $ul = $('> ul', $li),
- $siblings = $('.top-bar-element', $topbar).not($el);
- $menu_a.append('<span class="after" />');
- var $after = $('> .after', $menu_a);
- $after.on('click', function(e){
- e.stopPropagation();
- e.preventDefault();
- $menu_a.toggleClass('clicked');
- if ( $menu_a.hasClass('clicked') ) {
- $siblings.velocity("stop").velocity( 'slideUp', { duration: 500 });
- $ul.velocity("stop").velocity( 'slideDown', { duration: 500 });
- } else {
- $ul.velocity("stop").velocity( 'slideUp', { duration: 500 });
- $siblings.velocity("stop").velocity( 'slideDown', { duration: 500 });
- }
- });
- });
- $('#header-cart > a, #header-search > a', $menu_cont).each(function(){
- var $menu_a = $(this),
- $li = $('> ul > li', $menu_cont),
- $div_parent = $menu_a.parents('div').eq(0),
- $divs = $div_parent.siblings('div'),
- $div = $('> div', $div_parent);
- $menu_a.append('<span class="after" />');
- var $after = $('> .after', $menu_a);
- $after.on('click', function(e){
- e.stopPropagation();
- e.preventDefault();
- $menu_a.toggleClass('clicked');
- if ( $menu_a.hasClass('clicked') ) {
- $('> a', $li).add('> a', $divs).velocity("stop").velocity( 'slideUp', { duration: 500 });
- $div.velocity("stop").velocity( 'slideDown', { duration: 500 });
- } else {
- $div.velocity("stop").velocity( 'slideUp', { duration: 500 });
- $('> a', $li).add('> a', $divs).velocity("stop").velocity( 'slideDown', { duration: 500 });
- }
- });
- });
- winWCheck = $window.width();
- };
- checkRespoMenu();
- var setCheckMenu;
- $window.on( 'resize', function(){
- clearTimeout(setCheckMenu);
- setCheckMenu = setTimeout( checkRespoMenu, 30 );
- });
- $burger.on('click', function(e){
- var winW = $window.width();
- if ( winW <= respW ) {
- e.preventDefault();
- $burger.toggleClass('clicked');
- if ( $burger.hasClass('clicked') ) {
- $menu_cont.slideDown({ duration: 500 });
- } else {
- $menu_cont.slideUp({ duration: 500 });
- }
- }
- });
- /*$(document).on('revolution.slide.onchange', function(event, data){
- alert(data.slideIndex);
- });*/
- };
- MOOD.vcParallax = function(){
- var $parallaxVCelements = $('[data-vc-parallax]').removeAttr('data-vc-parallax');
- $parallaxVCelements.each(function(){
- var $tParax = $(this),
- param = ( typeof $tParax.attr('data-offset-param') != 'undefined' && $tParax.attr('data-offset-param') !== null && $tParax.attr('data-offset-param') !== '' ) ? $tParax.attr('data-offset-param') : '0.25',
- left = ( typeof $tParax.attr('data-parax-left') != 'undefined' && $tParax.attr('data-parax-left') !== null && $tParax.attr('data-parax-left') !== '' ) ? $tParax.attr('data-parax-left') : '0',
- right = ( typeof $tParax.attr('data-parax-right') != 'undefined' && $tParax.attr('data-parax-right') !== null && $tParax.attr('data-parax-right') !== '' ) ? $tParax.attr('data-parax-right') : '0',
- size_resp = ( typeof $tParax.attr('data-parax-resp-size') != 'undefined' && $tParax.attr('data-parax-resp-size') !== null && $tParax.attr('data-parax-resp-size') !== '' ) ? $tParax.attr('data-parax-resp-size') : '0',
- left_resp = ( typeof $tParax.attr('data-parax-left-resp') != 'undefined' && $tParax.attr('data-parax-left-resp') !== null && $tParax.attr('data-parax-left-resp') !== '' ) ? $tParax.attr('data-parax-left-resp') : '0',
- right_resp= ( typeof $tParax.attr('data-parax-right-resp') != 'undefined' && $tParax.attr('data-parax-right-resp') !== null && $tParax.attr('data-parax-right-resp') !== '' ) ? $tParax.attr('data-parax-right-resp') : '0',
- src = $tParax.data('vc-parallax-image'),
- $divParax = $('<div class="pix-parallax" data-offset-param="' + param + '" />').css({
- backgroundImage: 'url(' + src + ')',
- left: left + '%',
- right: right + '%',
- 'transition' : 'transform linear -1ms, -webkit-transform linear -1ms'
- }),
- $divParaxWrap = $('<div class="pix-parallax-wrap" />').css({
- 'transition' : 'transform linear -1ms, -webkit-transform linear -1ms'
- });
- if ( $tParax.attr('data-parallax-o-fade') == 'on' ) {
- $tParax.removeAttr('data-parallax-o-fade');
- $divParax.attr('data-parallax-o-fade','on');
- }
- if ( $('.vc-mood-overlay', $tParax).length ) {
- $('.vc-mood-overlay', $tParax).css({
- left: left + '%',
- right: right + '%'
- });
- }
- if ( !$('.pix-parallax', $tParax).length )
- $tParax.append( $divParaxWrap.append( $divParax ) );
- MOOD.parallax();
- var resizeParax = function(){
- var hRow = $tParax.outerHeight(),
- wH = $(window).height(),
- diff = (hRow - wH) * param;
- if ( hRow > wH )
- diff = 0;
- if ( size_resp !== 0 && $(window).width() <= size_resp ) {
- $divParax.css({
- left: left_resp + '%',
- right: right_resp + '%'
- });
- if ( $('.vc-mood-overlay', $tParax).length ) {
- $('.vc-mood-overlay', $tParax).css({
- left: left_resp + '%',
- right: right_resp + '%'
- });
- }
- } else {
- $divParax.css({
- left: left + '%',
- right: right + '%'
- });
- if ( $('.vc-mood-overlay', $tParax).length ) {
- $('.vc-mood-overlay', $tParax).css({
- left: left + '%',
- right: right + '%'
- });
- }
- }
- $divParax.css({
- bottom: diff,
- top: diff
- });
- };
- resizeParax();
- $(window).on('resize load pix-parallax', resizeParax);
- $(document.body).on('mood-loaded', resizeParax);
- });
- };
- MOOD.parallax = function(){
- var $parallaxElements = $('.pix-parallax, .double-parallax, [data-parallax="on"], [data-offset-param] .vc_video-bg iframe, [class*="rs-revert-parallaxlevel-"]').css({
- 'transition' : 'transform linear -1ms, -webkit-transform linear -1ms'
- }),
- matrix = [];
- var prefix = function(obj, prop, value) {
- var prefs = ['webkit', 'Moz', 'o', 'ms'];
- for (var pref in prefs) {
- obj.css( prefs[pref] + prop , value);
- }
- };
- var w_w = $(window).width(),
- w_h = $(window).height(),
- w_h_1_3 = w_h * 0.2,
- w_h_2_3 = w_h * 0.8,
- $spacer = $('#header-spacer'),
- spacerH = $spacer.outerHeight();
- var dataOffset = function(iEl){
- w_w = $(window).width();
- w_h = $(window).height();
- w_h_1_3 = w_h * 0.2;
- w_h_2_3 = w_h * 0.8;
- spacerH = $spacer.outerHeight();
- var $thisEl = $parallaxElements.eq(iEl);
- prefix($thisEl, "Transform", "translateY(0)");
- var elTop = $thisEl[0].getBoundingClientRect().top + window.scrollY,
- elBottom = $thisEl[0].getBoundingClientRect().bottom + window.scrollY,
- attr = $thisEl.attr('data-offset-top'),
- $overflow;
- if ( $thisEl.hasClass('pix-parallax') || $thisEl.hasClass('wpb_revslider_element') )
- $thisEl.parents('div').eq(0).addClass('overflow_hidden');
- if ( $thisEl.parents('.vc_row').eq(0).css('overflow') == 'hidden' ) {
- $overflow = $thisEl.parents('.vc_row').eq(0);
- } if ( $thisEl.parents('.pix-parallax-wrap').length ) {
- $overflow = $thisEl.parents('.pix-parallax-wrap').eq(0);
- } else {
- $overflow = $thisEl;
- }
- if (typeof attr !== typeof undefined && attr !== false && attr!=='' )
- elTop = attr;
- if ( $thisEl.is('[class*="rs-revert-parallaxlevel-"]') ) {
- var elClass = $thisEl.attr('class'),
- newParam = elClass.match(/rs-revert-parallaxlevel-([0-9])/i);
- newParam = parseFloat( newParam[1] );
- if ( newParam < 10 ) {
- newParam = newParam * -0.2;
- } else {
- newParam = ( 36 + newParam ) * -0.2;
- }
- $thisEl.attr('data-offset-param', newParam);
- }
- if ( typeof $thisEl.attr('data-offset-param') == 'undefined' || $thisEl.attr('data-offset-param') === null || $thisEl.attr('data-offset-param') === '' )
- $thisEl.attr('data-offset-param', '0.5');
- if ( $thisEl.hasClass('double-parallax') )
- $thisEl.attr('data-offset-param', '-0.075');
- if ( $thisEl.is('iframe') ) {
- var winH = $(window).height(),
- winW = $(window).width(),
- $parent = $thisEl.parents('[data-offset-param]').eq(0),
- paramParent = $parent.attr('data-offset-param'),
- parentHeight = parseFloat($parent.outerHeight()),
- wrapMore = (winH - parentHeight) * paramParent,
- wrapHeight = wrapMore + parentHeight,
- widthEl = wrapHeight * ( 16 / 9 );
- if ( widthEl < winW ) {
- widthEl = winW;
- wrapHeight = winW * ( 9 / 16 );
- }
- $thisEl.css({
- height: wrapHeight,
- width: widthEl,
- marginTop: wrapMore * -0.5,
- marginBottom: wrapMore * -0.5,
- marginLeft: (widthEl - winW) * -0.5,
- marginRight: (widthEl - winW) * -0.5
- });
- $thisEl.attr('data-offset-param', paramParent);
- }
- $thisEl.data('offset-top',elTop).data('offset-bottom',elBottom);
- matrix[iEl] = [];
- matrix[iEl].sectionTop = $overflow[0].getBoundingClientRect().top + window.scrollY;
- matrix[iEl].elTop = typeof dataOff != 'undefined' ? dataOff : $thisEl.data('offset-top');
- matrix[iEl].elBottom = $thisEl.data('offset-bottom'),
- matrix[iEl].elHeight = ( matrix[iEl].elBottom - matrix[iEl].elTop ),
- matrix[iEl].param = $thisEl.attr('data-offset-param'),
- matrix[iEl].halfThis = matrix[iEl].elTop==0 ? 0 : w_h/2 - matrix[iEl].elHeight/2;
- if ( $thisEl.hasClass('wpb_revslider_element') || $thisEl.attr('id') == 'header_parallax_bg' || $thisEl.attr('id') == '404_parallax_bg' ) {
- matrix[iEl].halfThis = 0;
- }
- };
- function onResize(iEl) {
- dataOffset(iEl);
- }
- function onScroll(iEl) {
- updateElement(iEl);
- }
- function updateElement(iEl) {
- var _this = $parallaxElements.eq(iEl),
- $overflow;
- if ( _this.parents('.vc_row').eq(0).css('overflow') == 'hidden' ) {
- $overflow = _this.parents('.vc_row').eq(0);
- } else if ( _this.parents('.pix-parallax-wrap').length ) {
- $overflow = _this.parents('.pix-parallax-wrap').eq(0);
- } else if ( _this.parents('#parrallax_wrap').length ) {
- $overflow = _this.parents('#parrallax_wrap').eq(0);
- } else {
- $overflow = _this;
- }
- var scrollTop = window.scrollY,
- $row_els = $overflow.find('> .vc_column_container'),
- sectionTop,
- sectionBottom,
- dataOff = matrix[iEl].dataOff,
- elTop = matrix[iEl].elTop,
- elBottom = matrix[iEl].elBottom,
- elHeight = matrix[iEl].elHeight,
- halfThis = matrix[iEl].halfThis,
- staticTop = matrix[iEl].sectionTop,
- param = matrix[iEl].param,
- dimens = ( elTop - halfThis ),
- css = {},
- newOpacity;
- if ( ( staticTop < w_h && sectionBottom < w_h ) || _this.attr('id') == 'header_parallax_bg' ) {
- dimens = spacerH; //so I'm sure it starts from 0 when loads
- }
- var move = ( spacerH + ( scrollTop - dimens ) ) * param,
- stat = halfThis * param,
- break_w = typeof mood_parallax_breakpoint !== typeof undefined && mood_parallax_breakpoint !== false && mood_parallax_breakpoint!=='' ? mood_parallax_breakpoint : 0;
- if ( MOOD.isElementInViewport(_this, (Math.abs(stat) * -1) ) ) {
- if ( w_w > break_w ) {
- if ( param == 1 && _this.hasClass('pix-parallax') ) {
- css.transform = '';
- css.backgroundAttachment = 'fixed';
- } else {
- if(Modernizr.csstransforms ) {
- css.transform = 'translateY(' + move + 'px)';
- if(Modernizr.csstransforms3d) {
- css.transform = 'translate3d(0, ' + move + 'px, 0)';
- }
- }
- }
- if ( _this.attr('data-parallax-o-fade')=='on' && typeof $row_els[0] != 'undefined' ) {
- sectionTop = $row_els[0].getBoundingClientRect().top + scrollTop + 40;
- sectionBottom = ( $row_els[0].getBoundingClientRect().bottom + scrollTop ) - 40;
- if ( ( sectionTop - w_h_1_3 ) < ( scrollTop + w_h ) && sectionBottom > ( scrollTop + w_h ) ) {
- newOpacity = ( ( scrollTop + w_h ) - sectionTop ) / w_h_1_3;
- } else if ( sectionBottom < ( scrollTop + w_h_1_3 ) ) {
- newOpacity = ( sectionBottom - scrollTop ) / w_h_1_3;
- } else {
- newOpacity = 1;
- }
- }
- newOpacity = newOpacity > 1 ? 1 : newOpacity;
- newOpacity = newOpacity < 0 ? 0 : newOpacity;
- $row_els.css({
- opacity: parseFloat(newOpacity)
- });
- } else {
- if(Modernizr.csstransforms ) {
- css.transform = 'translateY(0px)';
- if(Modernizr.csstransforms3d) {
- css.transform = 'translate3d(0, 0px, 0)';
- }
- }
- }
- _this.css(css);
- }
- }
- if ($parallaxElements !== null) {
- for ( var iEl = 0, lenEl = $parallaxElements.length; iEl < lenEl; iEl++) {
- dataOffset(iEl);
- updateElement(iEl);
- }
- }
- if ($parallaxElements !== null) {
- for(var k = 0, len = $parallaxElements.length; k < len; k++) {
- onScroll(k);
- }
- $(window).on('scroll.pix-parallax', function() {
- for(var k = 0, len = $parallaxElements.length; k < len; k++) {
- onScroll(k);
- }
- });
- var timeout;
- $(window).on('resize.pix-parallax orientationchange.pix-parallax load.pix-parallax pix-parallax isotoped', function() {
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- for(var k = 0, len = $parallaxElements.length; k < len; k++) {
- onResize(k);
- onScroll(k);
- }
- }, 100);
- });
- $(document.body).on('mood-loaded', function() {
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- for(var k = 0, len = $parallaxElements.length; k < len; k++) {
- onResize(k);
- onScroll(k);
- }
- }, 100);
- });
- }
- };
- MOOD.parallaxEls = function(){
- var $parallaxElements = $('[data-offset-param] .vc_video-bg iframe').css({
- 'transition' : 'transform linear -1ms, -webkit-transform linear -1ms'
- }),
- matrix = [];
- var prefix = function(obj, prop, value) {
- var prefs = ['webkit', 'Moz', 'o', 'ms'];
- for (var pref in prefs) {
- obj.css( prefs[pref] + prop , value);
- }
- };
- var w_w = $(window).width(),
- w_h = $(window).height(),
- w_h_1_3 = w_h * 0.2,
- w_h_2_3 = w_h * 0.8,
- $spacer = $('#header-spacer'),
- spacerH = $spacer.outerHeight();
- var dataOffset = function(iEl){
- w_w = $(window).width();
- w_h = $(window).height();
- w_h_1_3 = w_h * 0.2;
- w_h_2_3 = w_h * 0.8;
- spacerH = $spacer.outerHeight();
- var $thisEl = $parallaxElements.eq(iEl);
- prefix($thisEl, "Transform", "translateY(0)");
- var elTop = $thisEl[0].getBoundingClientRect().top + window.scrollY,
- elBottom = $thisEl[0].getBoundingClientRect().bottom + window.scrollY,
- attr = $thisEl.attr('data-offset-top'),
- $overflow;
- if ( $thisEl.hasClass('pix-parallax') || $thisEl.hasClass('wpb_revslider_element') )
- $thisEl.parents('div').eq(0).addClass('overflow_hidden');
- if ( $thisEl.parents('.vc_row').eq(0).css('overflow') == 'hidden' ) {
- $overflow = $thisEl.parents('.vc_row').eq(0);
- } if ( $thisEl.parents('.pix-parallax-wrap').length ) {
- $overflow = $thisEl.parents('.pix-parallax-wrap').eq(0);
- } else {
- $overflow = $thisEl;
- }
- if (typeof attr !== typeof undefined && attr !== false && attr!=='' )
- elTop = attr;
- if ( typeof $thisEl.attr('data-offset-param') == 'undefined' || $thisEl.attr('data-offset-param') === null || $thisEl.attr('data-offset-param') === '' )
- $thisEl.attr('data-offset-param', '0.5');
- if ( $thisEl.is('iframe') ) {
- var winH = $(window).height(),
- winW = $(window).width(),
- $parent = $thisEl.parents('[data-offset-param]').eq(0),
- paramParent = $parent.attr('data-offset-param'),
- parentHeight = parseFloat($parent.outerHeight()),
- wrapMore = (winH - parentHeight) * paramParent,
- wrapHeight = wrapMore + parentHeight,
- widthEl = wrapHeight * ( 16 / 9 );
- if ( widthEl < winW ) {
- widthEl = winW;
- wrapHeight = winW * ( 9 / 16 );
- }
- $thisEl.css({
- height: wrapHeight,
- width: widthEl,
- marginTop: wrapMore * -0.5,
- marginBottom: wrapMore * -0.5,
- marginLeft: (widthEl - winW) * -0.5,
- marginRight: (widthEl - winW) * -0.5
- });
- $thisEl.attr('data-offset-param', paramParent);
- }
- $thisEl.data('offset-top',elTop).data('offset-bottom',elBottom);
- matrix[iEl] = [];
- matrix[iEl].sectionTop = $overflow[0].getBoundingClientRect().top + window.scrollY;
- matrix[iEl].elTop = typeof dataOff != 'undefined' ? dataOff : $thisEl.data('offset-top');
- matrix[iEl].elBottom = $thisEl.data('offset-bottom'),
- matrix[iEl].elHeight = ( matrix[iEl].elBottom - matrix[iEl].elTop ),
- matrix[iEl].param = $thisEl.attr('data-offset-param'),
- matrix[iEl].halfThis = matrix[iEl].elTop==0 ? 0 : w_h/2 - matrix[iEl].elHeight/2;
- if ( $thisEl.hasClass('wpb_revslider_element') || $thisEl.attr('id') == 'header_parallax_bg' ) {
- matrix[iEl].halfThis = 0;
- }
- };
- function onResize(iEl) {
- dataOffset(iEl);
- }
- function onScroll(iEl) {
- updateElement(iEl);
- }
- function updateElement(iEl) {
- var _this = $parallaxElements.eq(iEl),
- $overflow;
- if ( _this.parents('.vc_row').eq(0).css('overflow') == 'hidden' ) {
- $overflow = _this.parents('.vc_row').eq(0);
- } else if ( _this.parents('.pix-parallax-wrap').length ) {
- $overflow = _this.parents('.pix-parallax-wrap').eq(0);
- } else if ( _this.parents('#parrallax_wrap').length ) {
- $overflow = _this.parents('#parrallax_wrap').eq(0);
- } else {
- $overflow = _this;
- }
- var scrollTop = window.scrollY,
- sectionTop = $thisEl[0].getBoundingClientRect().top + scrollTop,
- sectionBottom = $thisEl[0].getBoundingClientRect().bottom + scrollTop,
- sectionHeight = sectionTop - sectionBottom,
- break_w = typeof mood_parallax_breakpoint !== typeof undefined && mood_parallax_breakpoint !== false && mood_parallax_breakpoint!=='' ? mood_parallax_breakpoint : 0;
- css = {};
- if (sectionTop + sectionHeight > scrollTop && sectionTop < scrollTop + w_h) {
- if ( w_w > break_w ) {
- var dataOff = matrix[iEl].dataOff,
- elTop = matrix[iEl].elTop,
- elBottom = matrix[iEl].elBottom,
- elHeight = matrix[iEl].elHeight,
- param = matrix[iEl].param,
- halfThis = matrix[iEl].halfThis,
- staticTop = matrix[iEl].sectionTop,
- dimens = ( elTop - halfThis );
- if ( ( staticTop < w_h && (staticTop + sectionHeight) < w_h ) || _this.attr('id') == 'header_parallax_bg' ) {
- dimens = spacerH; //so I'm sure it starts from 0 when loads
- }
- var move = ( spacerH + ( scrollTop - dimens ) ) * param;
- if(Modernizr.csstransforms ) {
- css.transform = 'translateY(' + move + 'px)';
- if(Modernizr.csstransforms3d) {
- css.transform = 'translate3d(0, ' + move + 'px, 0)';
- }
- }
- if ( _this.attr('data-parallax-o-fade')=='on' ) {
- if ( ( sectionTop + sectionHeight/2 ) < ( scrollTop + w_h_1_3 ) ) {
- var newOpacity = ( ( sectionTop + sectionHeight/2 ) - (scrollTop + 80) ) / w_h_1_3;
- _this.css({
- opacity: parseFloat(newOpacity)
- });
- } else if ( ( sectionTop + sectionHeight/2 ) > ( scrollTop + w_h_2_3 ) ) {
- var newOpacity = ( (scrollTop + w_h + 80) - ( sectionTop + sectionHeight/2 ) ) / w_h_1_3;
- _this.css({
- opacity: parseFloat(newOpacity)
- });
- } else {
- _this.css({
- opacity: 1
- });
- }
- }
- } else {
- if(Modernizr.csstransforms ) {
- css.transform = 'translateY(0px)';
- if(Modernizr.csstransforms3d) {
- css.transform = 'translate3d(0, 0px, 0)';
- }
- }
- }
- _this.css(css);
- }
- }
- if ($parallaxElements !== null) {
- for ( var iEl = 0, lenEl = $parallaxElements.length; iEl < lenEl; iEl++) {
- dataOffset(iEl);
- updateElement(iEl);
- }
- }
- if (!Date.now)
- Date.now = function() { return new Date().getTime(); };
- if(!window.requestAnimationFrame)
- (function() {
- 'use strict';
- var vendors = ['webkit', 'moz'];
- for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
- var vp = vendors[i];
- window.requestAnimationFrame = window[vp+'RequestAnimationFrame'];
- window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame']
- || window[vp+'CancelRequestAnimationFrame']);
- }
- if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy
- || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
- var lastTime = 0;
- window.requestAnimationFrame = function(callback) {
- var now = Date.now();
- var nextTime = Math.max(lastTime + 16, now);
- return setTimeout(function() { callback(lastTime = nextTime); },
- nextTime - now);
- };
- window.cancelAnimationFrame = clearTimeout;
- }
- }());
- if ($parallaxElements !== null) {
- for(var k = 0, len = $parallaxElements.length; k < len; k++) {
- onScroll(k);
- }
- $(window).on('scroll.pix-parallax', function() {
- for(var k = 0, len = $parallaxElements.length; k < len; k++) {
- onScroll(k);
- }
- });
- var timeout;
- $(window).on('resize.pix-parallax orientationchange.pix-parallax load.pix-parallax isotoped', function() {
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- for(var k = 0, len =$parallaxElements.length; k < len; k++) {
- onResize(k);
- onScroll(k);
- }
- }, 100);
- });
- $(document.body).on('mood-loaded', function() {
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- for(var k = 0, len =$parallaxElements.length; k < len; k++) {
- onResize(k);
- onScroll(k);
- }
- }, 100);
- });
- }
- };
- MOOD.revSliders = function(){
- if ( ! $('.rev_slider').length )
- return false;
- $('.rev_slider').each(function(){
- var $slider = $(this),
- slider_id = $slider.attr('id');
- slider_id = slider_id.replace(/rev_slider_(.*)_1/g, '$1');
- if ( typeof window['revapi'+slider_id] == 'undefined' )
- return false;
- window['revapi'+slider_id].on('revolution.slide.onbeforeswap', function(event, data){
- var $next = data.nextslide;
- if ( $next.hasClass('alt-color') ) {
- $('body').addClass('alt-color');
- } else {
- $('body').removeClass('alt-color');
- }
- });
- window['revapi'+slider_id].on('revolution.slide.onloaded', function(event, data){
- $('body').addClass('revslider-loaded');
- });
- $( document.body ).on('mood-loaded', function(){
- window['revapi'+slider_id].revstart();
- });
- });
- };
- MOOD.childrenInviewport = function(){
- $('.mood-woo-styler[data-fx]').each(function(){
- var $this = $(this),
- fx = $this.attr('data-fx'),
- repeat = $this.attr('data-fx-repeat'),
- $li = $('li', $this);
- for (var li = 0, len = $li.length; li < len; li++) {
- //for ( var i = 0, len = a.length; i < len; i++) {
- if ( fx !== '' ) {
- $li.eq(li)
- .addClass(fx);
- if ( typeof repeat != 'undefined' && repeat == 'yes' )
- $li.eq(li).attr('data-fx-repeat', 'yes');
- }
- if ( li == len-1 ) {
- $this.removeAttr('data-fx');
- }
- }
- });
- $('.mood-pricing-table[data-fx]').each(function(){
- var $this = $(this),
- fx = $this.attr('data-fx'),
- repeat = $this.attr('data-fx-repeat'),
- $li = $('.mood-pricing-column-equalizer', $this);
- for (var li = 0, len = $li.length; li < len; li++) {
- //for ( var i = 0, len = a.length; i < len; i++) {
- if ( fx !== '' ) {
- $li.eq(li).attr('data-delay',(250 * li))
- .addClass(fx);
- if ( typeof repeat != 'undefined' && repeat == 'yes' )
- $li.eq(li).attr('data-fx-repeat', 'yes');
- }
- if ( li == len-1 ) {
- $this.removeAttr('data-fx');
- }
- }
- });
- };
- MOOD.inviewportMob = function(){
- if ( !$('body').hasClass('mobile-view') )
- return false;
- var $checkElements = $('.amount-chart, .numeric-counter, .mood-progress-wrap');
- function countProgress () {
- for ( var iEl = 0, lenEl = $checkElements.length; iEl < lenEl; iEl++) {
- var el = $checkElements.eq(iEl);
- if ( el.has('.amount-progress') ) {
- var $calculator = el.find('.amount-progress').css({ opacity: 1 }),
- amount = parseFloat( $calculator.attr('data-amount') ),
- position = $calculator.attr('data-position'),
- sign = $calculator.attr('data-sign');
- if ( position == 'before' )
- $calculator.text(sign + amount);
- else
- $calculator.text(amount + sign);
- }
- if ( el.hasClass('amount-chart') ) {
- var animate = parseFloat( el.data('pix-animate') ),
- size = parseFloat( el.outerWidth() ),
- max = parseFloat( el.data('max') ),
- coeff = max / 100,
- value = parseFloat( el.data('percent') ),
- $span = el.find('span.amount-counter').css({opacity: 1});
- el.css({
- height: size,
- opacity: 1
- }).easyPieChart({
- size: size,
- animate: 1,
- });
- $span.text( value * coeff );
- var clearSet;
- $(window).on('orientationchange', function(){
- size = parseFloat( el.outerWidth() );
- el.css({
- height: size
- });
- clearTimeout(clearSet);
- clearSet = setTimeout(function(){
- el.removeData('easyPieChart').find('canvas').remove();
- el.easyPieChart({
- size: size,
- animate: 1
- });
- }, 100);
- });
- }
- if ( el.hasClass('numeric-counter') ) {
- var amount = parseFloat( el.attr('data-value') ),
- $span = $('.counter-amount', el).css({opacity: 1}).text(amount);
- }
- }
- }
- countProgress();
- };
- MOOD.inviewport = function(){
- if ( $('body').hasClass('mobile-view') )
- return false;
- var $checkElements = $('.wpb_animate_when_almost_visible:not(.mood_start_animation):not(.animated):not(.wpb_start_animation):not([aria-hidden="true"]), .pix_animate_bar_almost_visible:not(.mood_start_animation):not(.animated):not(.wpb_start_animation):not([aria-hidden="true"]), [data-pix-bg], .amount-chart, .numeric-counter, svg.drawing, [data-fx-reveal], .vc-row-mood-scroll-down').filter(':notparents([data-fx])').filter(':notparents([aria-hidden="true"])');
- var $avoidElements = $('.wpb_animate_when_almost_visible[aria-hidden="true"], [aria-hidden="true"] .wpb_animate_when_almost_visible, .pix_animate_bar_almost_visible[aria-hidden="true"], [aria-hidden="true"] .pix_animate_bar_almost_visible').removeClass('wpb_animate_when_almost_visible pix_animate_bar_almost_visible wpb_top-to-bottom top-to-bottom wpb_bottom-to-top bottom-to-top wpb_left-to-right left-to-right wpb_right-to-left right-to-left wpb_appear mood_start_animation bounceIn bounceInDown bounceInLeft bounceInRight bounceInUp fadeIn fadeInDown fadeInDownBig fadeInLeft fadeInLeftBig fadeInRight fadeInRightBig fadeInUp fadeInUpBig flipInX flipInY lightSpeedIn rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rollIn zoomIn zoomInDown zoomInLeft zoomInRight zoomInUp slideInDown slideInLeft slideInRight slideInUp');
- function onResize() {
- checkElements();
- }
- function onScroll(evt) {
- requestAnimationFrame(checkElements);
- //checkElements();
- }
- function delayElements() {
- if ($checkElements !== null ) {
- var checkInView,
- iEl,
- lenEl = $checkElements.length,
- ind,
- nOff;
- for ( iEl = 0; iEl < lenEl; iEl++) {
- var _this = $checkElements.eq(iEl);
- nOff = _this.offset().top
- _this.attr('data-offset', nOff);
- ind = _this.index('[data-offset="' + nOff + '"]');
- nOff = _this.offset().top;
- if ( !_this.hasClass('mood_start_animation') && !_this.hasClass('animated') && !_this.hasClass('wpb_start_animation') ) {
- var delaytime = 200 * ( ind + 0.5 );
- if ( typeof _this.attr('data-delay') == 'undefined' || _this.attr('data-delay') === '' || _this.attr('data-delay') == 0 )
- _this.attr('data-delay', delaytime);
- }
- }
- }
- }
- window.rtimeOut=function(callback,delay){
- var dateNow = Date.now,
- requestAnimation = window.requestAnimationFrame,
- start = dateNow(),
- stop,
- timeoutFunc = function(){
- dateNow() - start < delay ? stop || requestAnimation(timeoutFunc) : callback()
- };
- requestAnimation(timeoutFunc);
- return {
- clear:function(){stop=1}
- }
- }
- function countProgress (el, time) {
- if ( el.has('.amount-progress') ) {
- var $calculator = el.find('.amount-progress'),
- amount = parseFloat( $calculator.attr('data-amount') ),
- position = $calculator.attr('data-position'),
- sign = $calculator.attr('data-sign'),
- counter = function(){
- $({progVal:0}).animate({progVal:amount}, {
- duration: 2000,
- start: function() {
- $calculator.delay(500).velocity({opacity:1},1500);
- },
- step: function() {
- if ( position == 'before' )
- $calculator.text(sign + Math.ceil(this.progVal));
- else
- $calculator.text(Math.ceil(this.progVal) + sign);
- },
- complete: function(){
- if ( position == 'before' )
- $calculator.text(sign + amount);
- else
- $calculator.text(amount + sign);
- }
- });
- },
- set = window.rtimeOut(counter, time);
- }
- if ( el.hasClass('amount-chart') ) {
- var animate = parseFloat( el.data('pix-animate') ),
- size = parseFloat( el.outerWidth() ),
- max = parseFloat( el.data('max') ),
- coeff = max / 100,
- $span = el.find('span.amount-counter').css({opacity: 1});
- el.css({
- height: size
- }).easyPieChart({
- size: size,
- animate: animate,
- onStep: function(from, to, currentValue) {
- $span.text(Math.round( currentValue * coeff ));
- }
- });
- $(window).trigger('scroll');
- var clearSet;
- $(window).on('resize', function(){
- size = parseFloat( el.outerWidth() );
- el.css({
- height: size
- });
- clearTimeout(clearSet);
- clearSet = setTimeout(function(){
- el.removeData('easyPieChart').find('canvas').remove();
- el.easyPieChart({
- size: size,
- animate: 1
- });
- }, 100);
- });
- }
- if ( el.hasClass('numeric-counter') ) {
- var amount = parseFloat( el.attr('data-value') ),
- $span = $('.counter-amount', el).css({opacity: 1});
- $span.velocity({
- tween: [ amount, 0 ]
- },{
- duration: 2000,
- progress: function(elements, c, r, s, t) {
- $span.text(Math.ceil(t))
- }
- });
- }
- }
- function elReveal (el, time) {
- var repeat = el.attr('data-fx-repeat'),
- reveal = function(){
- if ( !el.hasClass('mood_counted') ) {
- countProgress(el, time);
- el.addClass('mood_counted');
- }
- if ( typeof repeat == 'undefined' || repeat != 'yes' ) {
- if ( !el.hasClass('mood_animated') ) {
- el.addClass('mood_start_animation').addClass('animated').addClass('wpb_start_animation')
- .on('transitionend webkitTransitionEnd oTransitionEnd', function () {
- $(this).removeClass('wpb_animate_when_almost_visible pix_animate_bar_almost_visible wpb_top-to-bottom top-to-bottom wpb_bottom-to-top bottom-to-top wpb_left-to-right left-to-right wpb_right-to-left right-to-left wpb_appear mood_start_animation bounceIn bounceInDown bounceInLeft bounceInRight bounceInUp fadeIn fadeInDown fadeInDownBig fadeInLeft fadeInLeftBig fadeInRight fadeInRightBig fadeInUp fadeInUpBig flipInX flipInY lightSpeedIn rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rollIn zoomIn zoomInDown zoomInLeft zoomInRight zoomInUp slideInDown slideInLeft slideInRight slideInUp')
- .addClass('mood_animated');
- });
- }
- if ( el.attr('data-fx-reveal') == 'yes' )
- el.attr('data-fx-reveal', 'no');
- } else {
- el.removeClass('reloading-animation').addClass('mood_start_animation').addClass('animated').addClass('wpb_start_animation');
- if ( el.attr('data-fx-reveal') == 'yes' )
- el.attr('data-fx-reveal', 'no').removeClass('reloading-animation');
- }
- },
- set = window.rtimeOut(reveal, time);
- }
- function elHide (el) {
- var hide = function(){
- if ( el.hasClass('mood_start_animation') || el.hasClass('animated') ) {
- var delay = parseFloat( el.attr('data-delay') );
- el.removeAttr('data-delay').addClass('reloading-animation').removeClass('mood_start_animation').removeClass('animated').removeClass('wpb_start_animation').removeClass('mood_counted').attr('data-delay', delay);
- }
- if ( el.attr('data-fx-reveal') == 'no' )
- el.attr('data-fx-reveal', 'yes').addClass('reloading-animation');
- },
- set = window.rtimeOut(hide);
- }
- function checkElements() {
- if ($checkElements !== null) {
- var iEl,
- lenEl = $checkElements.length,
- action = 0;
- for ( iEl = 0; iEl < lenEl; iEl++) {
- var _this = $checkElements.eq(iEl),
- delay = parseFloat(_this.attr('data-delay')),
- repeat = _this.attr('data-fx-repeat'),
- inView = _this.data('inview');
- if ( ! _this.hasClass( 'vc-row-mood-scroll-down' ) ) {
- if ( MOOD.isElementInViewport( _this ) ) {
- elReveal(_this, delay);
- }
- if ( typeof repeat != 'undefined' && repeat == 'yes' ) {
- if ( ! MOOD.isElementInViewport( _this, -100 ) ) {
- elHide(_this);
- }
- }
- } else {
- if ( MOOD.isBelowViewport( _this, 10 ) ) {
- _this.addClass('fake_hidden');
- } else {
- _this.removeClass('fake_hidden');
- }
- }
- }
- }
- }
- if (!Date.now) {
- Date.now = function() { return new Date().getTime(); };
- }
- if(!window.requestAnimationFrame) {
- (function() {
- 'use strict';
- var vendors = ['webkit', 'moz'];
- for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
- var vp = vendors[i];
- window.requestAnimationFrame = window[vp+'RequestAnimationFrame'];
- window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame']
- || window[vp+'CancelRequestAnimationFrame']);
- }
- if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy
- || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
- var lastTime = 0;
- window.requestAnimationFrame = function(callback) {
- var now = Date.now();
- var nextTime = Math.max(lastTime + 16, now);
- return setTimeout(function() { callback(lastTime = nextTime); },
- nextTime - now);
- };
- window.cancelAnimationFrame = clearTimeout;
- }
- }());
- }
- $(window).on('scroll.pix-inview', function() {
- onScroll();
- });
- var timeout;
- $(window).on('resize.pix-inview load.pix-inview orientationchange.pix-inview pix-inview isotoped', function() {
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- delayElements();
- onResize();
- onScroll();
- }, 10);
- });
- delayElements();
- onScroll();
- $('svg.drawing').each(function(){
- var $svg = $(this),
- $svg0 = $svg[0],
- id = MOOD.guidGenerator(),
- delay = parseFloat( $svg.attr('data-delay') ),
- repeat = $svg.attr('data-fx-repeat'),
- time = $svg.attr('data-animation-time'),
- duration = typeof time != 'undefined' && time !== '' ? parseFloat(time) : 300,
- svgTimeOut;
- $svg.attr('id', id);
- if ( typeof delay == 'undefined' || delay === '' )
- return false;
- var startAnimation = function(){
- new Vivus(id, {
- type: 'delayed',
- duration: duration,
- animTimingFunction: Vivus.LINEAR,
- start: 'manual',
- onReady: function (vivusObj) {
- var listener = function () {
- if ( MOOD.isElementInViewport( $svg0 ) ) {
- svgTimeOut = setTimeout( function(){
- $svg.css({ opacity: 1 });
- vivusObj.play();
- }, delay );
- }
- if ( typeof repeat != 'undefined' && repeat == 'yes' ) {
- if ( ! MOOD.isElementInViewport( $svg, -100 ) ) {
- $svg.css({ opacity: 0 });
- vivusObj.play(-100);
- }
- }
- };
- listener();
- $(window).on('scroll.pix-inview', function() {
- listener();
- });
- var timeoutVivus;
- $(window).on('resize.pix-inview orientationchange.pix-inview', function() {
- clearTimeout(timeoutVivus);
- timeoutVivus = setTimeout(function() {
- listener();
- }, 10);
- });
- }
- });
- };
- startAnimation();
- });
- };
- MOOD.verticalTitles = function(){
- var titlePos = function(){
- $('.mood-vertical-title').each(function(){
- var $title = $(this),
- height = $title.height();
- $title.css({
- marginTop: '-' + ( height / 2 ) + 'px'
- });
- });
- };
- titlePos();
- $(window).on('load', titlePos);
- };
- MOOD.masonry = function(){
- //WooCommerce
- var $products = $('.products').not('.upsells').not('.related').each(function(){
- var $this = $(this),
- $parent = $this.parents('.mood-woo-styler').eq(0),
- layout;
- if ( $parent.length && typeof $parent.attr('data-layout') != 'undefined' && $parent.attr('data-layout') !== '' ) {
- layout = $parent.attr('data-layout');
- } else {
- layout = 'fitRows';
- }
- if ( layout != 'carousel' ) {
- $this.imagesLoaded({ background: true }, function() {
- $this.isotope({
- masonry: {
- columnWidth: 1
- },
- //itemSelector: 'li',
- hiddenStyle: {
- opacity: 0
- },
- visibleStyle: {
- opacity: 1
- },
- layoutMode: layout,
- isOriginLeft: !mood_rtl
- });
- $( window ).trigger( 'isotoped' );
- $( document.body ).on('video-fit', function () {
- if ( MOOD.isElementInViewport($this) )
- $this.isotope('layout');
- $( window ).trigger( 'isotoped' );
- });
- });
- }
- });
- //Post shortcode
- var $posts = $('.post-list[data-grid]').not('[data-grid="carousel"]').each(function(){
- var $this = $(this),
- layout = $this.data('grid'),
- gutter = $this.data('gutter'),
- width = parseFloat( $this.data('width') ),
- height = parseFloat( $this.data('height') ),
- cols = parseFloat( $this.data('columns') ),
- metro = $this.data('metro'),
- $filter = $this.parents('.post-list-spacer').eq(0).prev('.post-list-filter-wrap').find('.pix-portfolio-filters, .pix-post-filters'),
- isoOptions,
- wrap_w,
- tot_gutter = gutter * cols,
- single_w, single_w_tot,
- artLenght = $('> article, > li, > div', $this).length;
- if ( !$filter.length ) {
- $filter = $this.prev('.post-list-filter-wrap').find('.pix-portfolio-filters, .pix-post-filters');
- }
- layout = layout !== '' && layout !== null ? layout : 'fitRows';
- gutter = gutter !== '' ? parseFloat( gutter ) : 30;
- width = width !== 0 ? width : 4;
- cols = cols !== 0 ? cols : 3;
- $('> article, > div, > li', $this).addClass('isotoping');
- $('a', $filter).each(function(){
- var tag = $(this).data('filter-tag');
- if ( !$('.tag-' + tag, $this ).length )
- $(this).addClass('hidden_important');
- });
- var metroTmout;
- var postIsotope = function(){
- $this.imagesLoaded({ background: true }, function() {
- isoOptions = {
- masonry: {
- columnWidth: 1
- },
- itemSelector: 'article, li, .isotoping',
- hiddenStyle: {
- opacity: 0
- },
- visibleStyle: {
- opacity: 1
- },
- layoutMode: layout,
- isOriginLeft: !mood_rtl,
- resize: false
- };
- $this.isotope(isoOptions);
- $( window ).trigger( 'isotoped' );
- $('a[data-filter-tag]', $filter).on('click', function(e){
- e.preventDefault();
- $('a[data-filter-tag].selected', $filter).removeClass('selected');
- $(this).addClass('selected');
- var tag = $(this).data('filter-tag');
- isoOptions.filter = '.tag-' + tag;
- $this.isotope(isoOptions);
- setTimeout(function(){
- MOOD.inviewport();
- $(window).trigger('pix-parallax');
- }, 500);//isotope transition time
- });
- $( document.body ).on('video-fit metro-layout', function () {
- //if ( MOOD.isElementInViewport($this) ) {
- $this.isotope('layout');
- $( window ).trigger( 'isotoped' );
- //}
- });
- });
- };
- var setHeights = function(resize){
- var winW = $(window).width();
- if ( winW > 1024 ) {
- cols = parseFloat( $this.data('columns') );
- } else if ( winW <= 1024 && winW > 768 ) {
- if ( typeof $this.data('landscape') != 'undefined' && $this.data('landscape') !== '' && $this.data('landscape') != null )
- cols = parseFloat( $this.data('landscape') );
- else
- cols = parseFloat( $this.data('columns') );
- } else if ( winW <= 768 && winW > 414 ) {
- if ( typeof $this.data('portrait') != 'undefined' && $this.data('portrait') !== '' && $this.data('portrait') != null )
- cols = parseFloat( $this.data('portrait') );
- else if ( typeof $this.data('landscape') != 'undefined' && $this.data('landscape') !== '' && $this.data('landscape') != null )
- cols = parseFloat( $this.data('landscape') );
- else
- cols = parseFloat( $this.data('columns') );
- } else {
- if ( typeof $this.data('phone') != 'undefined' && $this.data('phone') !== '' && $this.data('phone') != null )
- cols = parseFloat( $this.data('phone') );
- else if ( typeof $this.data('portrait') != 'undefined' && $this.data('portrait') !== '' && $this.data('portrait') != null )
- cols = parseFloat( $this.data('portrait') );
- else if ( typeof $this.data('landscape') != 'undefined' && $this.data('landscape') !== '' && $this.data('landscape') != null )
- cols = parseFloat( $this.data('landscape') );
- else
- cols = parseFloat( $this.data('columns') );
- }
- tot_gutter = gutter * cols;
- wrap_w = Math.floor( $this[0].getBoundingClientRect().width ) - 1;
- single_w = ( wrap_w - tot_gutter ) / cols;
- single_w_tot = wrap_w / cols;
- var setHeight = function(len){
- var $article = $('> article, > div, > li', $this).eq(len),
- newH = height / width,
- newH2,
- newHhalf,
- articleW = $article.data('view'),
- newW = Math.floor( single_w_tot ),
- newW2 = ( newW * 2 );
- newH = Math.floor( newH * single_w );
- newH2 = Math.floor( newH * 2 + gutter );
- newHhalf = Math.floor( newH / 2 + gutter );
- if ( ! $article.hasClass('text-position-right') && ! $article.hasClass('text-position-left') && ! $article.hasClass('text-position-half-left') && ! $article.hasClass('text-position-half-right') ) {
- if ( metro == 'yes' ) {
- if ( ( $article.attr('data-view') == 'double_both' && cols > 1 ) || $article.attr('data-view') == 'double_height' ) {
- newH = newH2;
- }
- if ( $article.attr('data-view') == 'double_width' && cols == 1 )
- newH = newHhalf;
- $('.wp-post-image', $article).css({
- height: newH
- });
- if ( $article.hasClass('format-quote') && cols > 1 ) {
- $('.entry-text', $article).css({
- height: newH
- });
- }
- if ( ( $article.attr('data-view') == 'double_both' || $article.attr('data-view') == 'double_width' ) && cols > 1 )
- newW = newW2;
- }
- $article.css({
- width: newW
- });
- }
- if ( resize ) {
- clearTimeout(metroTmout);
- metroTmout = setTimeout(function(){
- $( document.body ).trigger('metro-layout');
- }, 400);
- }
- if ( (len+1) == artLenght && (typeof resize === "undefined" || resize === null) )
- postIsotope();
- };
- for(var k = 0, len = artLenght; k < len; k++) {
- setHeight(k);
- }
- };
- $( window ).on('infinite-loaded', function () {
- var $elements = $this.find('> article:not(.isotoping)');
- $elements.addClass('isotoping');
- $this.isotope( 'appended', $elements );
- $this.imagesLoaded({ background: true }, function() {
- $this.isotope('layout');
- $('.transparent_opacity').removeClass('transparent_opacity');
- setTimeout(function(){
- MOOD.inviewport();
- $(window).trigger('pix-parallax');
- }, 500);//isotope transition time
- });
- $('a.hidden_important', $filter).each(function(){
- var tag = $(this).data('filter-tag');
- if ( $('.tag-' + tag, $this ).length )
- $(this).removeClass('hidden_important');
- });
- });
- var setResizeOpen;
- $( window ).on('resize', function(){
- clearTimeout(setResizeOpen);
- setResizeOpen = setTimeout( function(){
- setHeights(true);
- }, 250 );
- });
- $( document.body ).on('vc-full-width-row', setHeights);
- setHeights();
- });
- var $members = $('.member-list[data-grid]').each(function(){
- var $this = $(this),
- layout = $this.data('grid'),
- isoOptions;
- $('> li', $this).addClass('isotoping');
- $this.imagesLoaded({ background: true }, function() {
- isoOptions = {
- masonry: {
- columnWidth: 1
- },
- itemSelector: 'li',
- hiddenStyle: {
- opacity: 0
- },
- visibleStyle: {
- opacity: 1
- },
- layoutMode: layout,
- isOriginLeft: !mood_rtl
- };
- $this.isotope(isoOptions);
- $( window ).trigger( 'isotoped' );
- $( document.body ).on('video-fit', function () {
- if ( MOOD.isElementInViewport($this) )
- $this.isotope('layout');
- $( window ).trigger( 'isotoped' );
- });
- });
- });
- var $gallery = $('.gallery-shortcode-grid').each(function(){
- var $this = $(this),
- layout = $this.data('layout'),
- isoOptions;
- $('> div', $this).addClass('isotoping');
- if ( typeof layout == 'undefined' && layout === '' && layout == null )
- layout = 'fitRows';
- $this.imagesLoaded({ background: true }, function() {
- isoOptions = {
- masonry: {
- columnWidth: 1
- },
- itemSelector: 'div',
- hiddenStyle: {
- opacity: 0
- },
- visibleStyle: {
- opacity: 1
- },
- layoutMode: layout,
- isOriginLeft: !mood_rtl
- };
- $this.isotope(isoOptions);
- $( window ).trigger( 'isotoped' );
- });
- $( document.body ).on('video-fit', function () {
- if ( MOOD.isElementInViewport($this) )
- $this.isotope('layout');
- $( window ).trigger( 'isotoped' );
- });
- });
- $('body, #header_parallax_bg, .pix-parallax').imagesLoaded({ background: true }, function() {
- $( document.body ).trigger('mood-loaded');
- $('body').addClass('mood-loaded');
- });
- };
- MOOD.infiniteScroll = function(){
- var $post_list = $('.post-list');
- $post_list.each(function(){
- var $list = $(this),
- the_id = $list.attr('id'),
- $pagination = $list.parents('.post-list-spacer').eq(0).next('.mood-pagination');
- if ( ! $pagination.length )
- $pagination = $list.next('.mood-pagination');
- var $more = $pagination.find('> a.mood-infinite-handle').eq(0),
- href,
- $next, next_url,
- $loadedWrap, $loadedContent,
- loadTimeout;
- $more.each(function(e){
- var $this_more = $(this);
- var loadContentMore = function(){
- clearTimeout(loadTimeout);
- href = $this_more.attr('href');
- $.ajax({
- url: href,
- success: function(loadedData){
- $loadedWrap = $("<div/>").append(loadedData.replace(/<script(.|\s)*?\/script>/g, ""));
- //console.log(loadedData);
- $loadedContent = $loadedWrap.find('#' + the_id + ' > article');
- $loadedContent.find('.ce-iframe').each(function(){
- var $iframe = $(this),
- src = $iframe.attr('data-ce-src');
- $iframe.attr('src',src).removeClass('ce-iframe').removeAttr('data-ce-src');
- });
- $next = $loadedWrap.find('.mood-infinite-handle');
- next_url = $next.attr('href');
- }, complete: function(){
- $('body').append('<div id="loaded-infinite-sandbox" class="hidden_important ' + the_id + '" data-url="' + next_url + '" />');
- $('#loaded-infinite-sandbox.' + the_id).append($loadedContent);
- }
- });
- };
- var appendContentMore = function(){
- if ( $('#loaded-infinite-sandbox.' + the_id).length ) {
- $this_more.removeClass('infinite-loading');
- $loadedContent = $('#loaded-infinite-sandbox.' + the_id).html();
- next_url = $('#loaded-infinite-sandbox.' + the_id).attr('data-url');
- $list.append($loadedContent);
- MOOD.init_videos();
- if ( $('video').length )
- $('video').mediaelementplayer();
- MOOD.fitVideos();
- MOOD.initColorbox();
- if ( typeof next_url != 'undefined' && next_url !== '' && next_url != 'undefined' )
- $more.attr('href', next_url);
- else
- $pagination.slideUp();
- $( window ).trigger('infinite-loaded');
- $('#loaded-infinite-sandbox.' + the_id).remove();
- MOOD.parallax();
- MOOD.inviewport();
- MOOD.masonry();
- } else {
- clearTimeout(loadTimeout);
- href = $this_more.attr('href');
- $.ajax({
- url: href,
- success: function(loadedData){
- $loadedWrap = $("<div/>").append(loadedData.replace(/<script(.|\s)*?\/script>/g, ""));
- $loadedContent = $loadedWrap.find('#' + the_id + ' > article');
- $loadedContent.find('.ce-iframe').each(function(){
- var $iframe = $(this),
- src = $iframe.attr('data-ce-src');
- $iframe.attr('src',src).removeClass('ce-iframe').removeAttr('data-ce-src');
- });
- $next = $loadedWrap.find('.mood-infinite-handle');
- next_url = $next.attr('href');
- }, complete: function(){
- $this_more.removeClass('infinite-loading');
- $list.append($loadedContent);
- MOOD.init_videos();
- if ( $('video').length )
- $('video').mediaelementplayer();
- MOOD.fitVideos();
- //MOOD.initColorbox();
- if ( typeof next_url != 'undefined' && next_url !== '' && next_url != 'undefined' )
- $more.attr('href', next_url);
- else
- $pagination.slideUp();
- $( window ).trigger('infinite-loaded');
- $('#loaded-infinite-sandbox.' + the_id).remove();
- MOOD.parallax();
- MOOD.inviewport();
- MOOD.masonry();
- }
- });
- }
- };
- $( window ).on('load', function(){
- loadTimeout = setTimeout(loadContentMore, 1000);
- });
- $( window ).on('infinite-loaded', function(){
- loadTimeout = setTimeout(loadContentMore, 1000);
- });
- $this_more.on('click', function(e){
- var setInfiniteLoader = setInterval(function () {
- var dur = 350,
- ease = 'swing',
- $rect = $('.mood-infinite-handle rect');
- $rect
- .velocity({ x: 70, width: 0 }, dur, ease)
- .velocity({ x: 0, width: 70 }, dur, ease)
- .velocity({ x: 0, width: 0 }, dur, ease)
- .velocity({ x: 0, width: 70 }, dur, ease);
- });
- e.preventDefault();
- $this_more.addClass('infinite-loading');
- setTimeout(function(){
- appendContentMore();
- clearInterval(setInfiniteLoader);
- }, 1000);
- });
- });
- });
- };
- MOOD.zoomImage = function(){
- var $body = $('body'),
- $images = $('.images');
- if ( $body.hasClass('no-zoom') )
- return;
- $images.each(function(){
- var t = $(this),
- url = $('a.woocommerce-main-image', t).attr('href');
- t.zoom({
- url: url
- });
- });
- };
- MOOD.zoomDestroy = function(){
- $('a.woocommerce-main-image').trigger('zoom.destroy');
- $('.images .zoomImg').remove();
- };
- MOOD.productImageCarousel = function(){
- var $product_images = $('.single-product .images');
- $product_images.each(function(){
- var $images = $(this),
- $main = $('a.woocommerce-main-image', $images),
- $thumbs = $('.thumbnails', $images),
- href, src;
- $('a', $thumbs).on('click touchstart', function(e){
- e.preventDefault();
- e.stopPropagation();
- if ( $(this).hasClass('selected') )
- return false;
- $('a.selected', $thumbs).removeClass('selected');
- $(this).addClass('selected');
- href = $(this).attr('href');
- src = $(this).attr('data-src');
- $images.velocity({
- opacity: 0.5
- }, {
- duration: 250,
- easing: [ 0.140, 0.560, 0.710, 0.975 ],
- complete: function(){
- $('<img />').one('load',function(){
- $main.attr('href', href).find('img').attr('src', src).removeAttr('srcset').removeAttr('sizes');
- MOOD.zoomDestroy();
- MOOD.zoomImage();
- $images.velocity({
- opacity: 1
- });
- }).attr('src', src).each(function() {
- if(this.complete) {
- $(this).load();
- }
- });
- }
- });
- });
- });
- };
- MOOD.resetVariations = function(){
- $('form.variations_form').each(function(){
- var $form = $(this),
- selected,
- $input = $('input.variation_id', $form),
- $thumbnails = $form.parents('.single-product').eq(0).find('.images .thumbnails').eq(0),
- variation_id,
- val,
- ind,
- variations,
- src,
- i, l,
- set;
- var changeVariation = function(){
- selected = $('option:selected', $form);
- ind = selected.index();
- val = selected.val();
- if ( ind > 0 ) {
- variations = $form.data('product_variations');
- variation_id = $input.val();
- l = variations.length;
- for (i = 0; i < l; i++) {
- if ( variations[i].variation_id == variation_id ) {
- src = variations[i].image_src;
- if ( src !== '' && typeof src != 'undefined' ) {
- src = MOOD.basename(src);
- //console.log(src);
- $('a[href*="' + src + '"]', $thumbnails).click();
- } else {
- $('a', $thumbnails).eq(0).click();
- }
- }
- }
- } else {
- $('a', $thumbnails).eq(0).click();
- }
- };
- $(document).on( 'found_variation reset_image', $form, changeVariation );
- });
- };
- MOOD.basename = function(str) {
- return str.replace(/\\/g,'/').replace( /.*\//, '' );
- };
- MOOD.product_quickview = function(){
- $('ul.products li.product .wpb_wl_preview').each(function(){
- var $button = $(this),
- href = $button.data('href'),
- $href = $('[data-id="' + href.replace(/^#/,"") + '"]').eq(0),
- rel = $button.data('rel'),
- h;
- var href_content = '';
- $href.contents().filter(function(){
- return this.nodeType == 8;
- }).each(function(i, e){
- href_content = href_content + e.nodeValue;
- });
- if ( href_content != '' )
- $href.html(href_content);
- h = parseFloat($('.images .wp-post-image', $href).attr('height'));
- $button.colorbox({
- inline: true,
- href: $href,
- rel: rel,
- //maxHeight: "90%",
- height: h,
- maxWidth: "80%",
- onComplete: function(){
- MOOD.zoomDestroy();
- MOOD.zoomImage();
- MOOD.productImageCarousel();
- MOOD.resetVariations();
- }
- });
- });
- };
- window.vc_prettyPhoto = function () {
- $('.prettyphoto').each(function(){
- $(this).removeClass('prettyphoto').addClass('cbox');
- var relData = $(this).attr('rel');
- $(this).removeAttr('rel').attr('data-rel', relData);
- });
- MOOD.initColorbox();
- };
- MOOD.initColorbox = function(){
- if($.isFunction($.fn.colorbox) /*&& typeof(pix_style_enable_colorbox)!='undefined' && pix_style_enable_colorbox===true*/) {
- var $window = $(window),
- notIn = ':not(.noColorBox,.nocolorbox,.letmebe,.zoom)',
- elems,
- $elems;
- $('div.gallery a').attr('rel','gallery');
- var initColorboxCall = function(){
- elems = ".cboxiframe, .cboxinline, .cbox, a[href$='.jpg']"+notIn+", a[href*='.jpg?']"+notIn+", a[href$='.jpeg']"+notIn+", a[href*='.jpeg?']"+notIn+", a[href$='.gif']"+notIn+", a[href*='.gif?']"+notIn+", a[href$='.png']"+notIn+", a[href*='.png?']"+notIn;
- $elems = $(elems);
- $elems.each(function(){
- var $el = $(this),
- dataRel = $el.data('rel'),
- dataTitle = $el.data('title'),
- dataName = $el.find('img').data('name'),
- dataSubtitle = $el.find('img').data('subtitle'),
- dataNotes = $el.find('img').data('notes'),
- href = $el.attr('href'),
- iframe = $el.hasClass('cboxiframe'),
- noprevent = $el.hasClass('noprevent'),
- inline = $el.hasClass('cboxinline'),
- innerW = typeof $el.data('size') != 'undefined' ? $el.data('size')[0] : false,
- innerH = typeof $el.data('size') != 'undefined' ? $el.data('size')[1] : false,
- videoW = 0,
- videoH = 0,
- videoR = 0,
- winW, winH;
- var cboxOptions = {
- maxWidth: "85%",
- maxHeight: "85%",
- rel: dataRel,
- title: dataTitle,
- fixed: true,
- returnFocus: false,
- iframe: iframe,
- inline: inline,
- innerWidth: innerW,
- innerHeight: innerH,
- scrolling: !inline,
- onComplete: function(){
- if ( ( typeof dataName != 'undefined' && dataName != '' ) || ( typeof dataSubtitle != 'undefined' && dataSubtitle != '' ) || ( typeof dataNotes != 'undefined' && dataNotes != '' ) ) {
- $('.cboxPhoto').before('<div id="cbox-extra" />');
- if ( typeof dataName != 'undefined' && dataName != '' ) {
- $('#cbox-extra').append('<div class="cbox-name"><h4>' + dataName + '</h4></div>');
- }
- if ( typeof dataSubtitle != 'undefined' && dataSubtitle != '' ) {
- $('#cbox-extra').append('<div class="cbox-subtitle"><small>' + dataSubtitle + '</small></div>');
- }
- if ( typeof dataNotes != 'undefined' && dataNotes != '' ) {
- $('#cbox-extra').append('<div class="cbox-notes"><p>' + dataNotes + '</p></div>');
- }
- setTimeout(function(){
- $('#cbox-extra').addClass('revealed');
- }, 250);
- } else {
- $('#cbox-extra').remove();
- }
- if ( !iframe && !noprevent )
- $('#cboxLoadedContent').prepend('<div class="cboxPrevent" />');
- $.data(document.body, 'pix-check-colorbox-opened',true);
- $.data(document.body, 'pix-check-colorbox-open',$el);
- MOOD.init_videos();
- if ( $('#cboxLoadedContent').find('audio, video').length ) {
- var $media = $('#cboxLoadedContent').find('audio, video');
- if ( $media.attr('autoplay') == 'autoplay' ) {
- $media[0].player.setCurrentTime(0);
- $media[0].player.play();
- }
- }
- },
- onOpen: function(){
- if ( ( typeof dataName != 'undefined' && dataName != '' ) || ( typeof dataSubtitle != 'undefined' && dataSubtitle != '' ) || ( typeof dataNotes != 'undefined' && dataNotes != '' ) ) {
- $('.cboxPhoto').before('<div id="cbox-extra" />');
- if ( typeof dataName != 'undefined' && dataName != '' ) {
- $('#cbox-extra').append('<div class="cbox-name"><h4>' + dataName + '</h4></div>');
- }
- if ( typeof dataSubtitle != 'undefined' && dataSubtitle != '' ) {
- $('#cbox-extra').append('<div class="cbox-subtitle"><small>' + dataSubtitle + '</small></div>');
- }
- if ( typeof dataNotes != 'undefined' && dataNotes != '' ) {
- $('#cbox-extra').append('<div class="cbox-notes"><p>' + dataNotes + '</p></div>');
- }
- setTimeout(function(){
- $('#cbox-extra').addClass('revealed');
- }, 250);
- } else {
- $('#cbox-extra').remove();
- }
- },
- onClosed: function(){
- $.removeData(document.body, 'pix-check-colorbox-opened');
- if ( !iframe )
- $('#cboxLoadedContent .cboxPrevent').remove();
- }
- };
- $el.colorbox(cboxOptions);
- var setResizeOpen,
- resizeCBox = function(){
- $.data(document.body, 'pix-check-colorbox-open').colorbox.close();
- };
- $window.on('resize', function(){
- if ( typeof $.data(document.body, 'pix-check-colorbox-opened') !== 'undefined' && $.data(document.body, 'pix-check-colorbox-opened') === true ) {
- clearTimeout(setResizeOpen);
- setResizeOpen = setTimeout( resizeCBox, 250 );
- }
- });
- });
- };
- }
- initColorboxCall();
- $(window).on('infinite-loaded', function(){
- initColorboxCall();
- });
- $(document).on('cbox_open', function(){
- $('html, body').addClass('overflow_hidden');
- });
- $(document).on('cbox_closed', function(){
- $('html, body').removeClass('overflow_hidden');
- });
- };
- MOOD.accordion = function(){
- $( ".woocommerce-tabs" ).accordion({
- heightStyle: "content",
- create: function(event, ui){
- if ( $('.ui-accordion-header', this).length <= 1 )
- $(this).addClass('single-tab');
- }
- });
- /*$( "#comments" ).accordion({
- active: 0,
- collapsible: true,
- heightStyle: "content",
- header: "h3.comments-title"
- });*/
- };
- MOOD.sharingWindows = function(){
- var $links = $('a.mood-sharing');
- $links.each(function(){
- var $this = $(this),
- url = $this.attr('href'),
- $window = $(window),
- left = (screen.width/2)-250,
- top = (screen.height/4);
- $this.on('click', function(e){
- e.preventDefault();
- window.open(url, '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=500, height=250, left=' + left + ', top=' + top);
- });
- });
- };
- MOOD.postSliders = function(){
- $('.mood-woo-styler[data-layout="carousel"] ul.products').each(function(){
- var $carousel = $(this).imagesLoaded({ background: true }, function() {
- var $parent = $carousel.parents('.mood-woo-styler').eq(0),
- responsive = [],
- dots;
- if ( $parent.length && typeof $parent.attr('data-dots') != 'undefined' && $parent.attr('data-dots') !== '' ) {
- dots = true;
- } else {
- dots = false;
- }
- if ( $parent.data('landscape')!=='' ) {
- responsive.push({
- breakpoint: 1025,
- settings: {
- slidesToShow: $parent.data('landscape')
- }
- });
- }
- if ( $parent.data('portrait')!=='' ) {
- responsive.push({
- breakpoint: 769,
- settings: {
- slidesToShow: $parent.data('portrait')
- }
- });
- }
- if ( $parent.data('phone')!=='' ) {
- responsive.push({
- breakpoint: 415,
- settings: {
- slidesToShow: $parent.data('phone')
- }
- });
- }
- $carousel.on('init beforeChange breakpoint reInit setPosition', function(event, slick, currentSlide, nextSlide){
- var height = 0;
- $('[aria-hidden="false"]', $carousel).each(function(){
- var thisH = $(this).outerHeight();
- if ( height < thisH ) {
- height = thisH;
- }
- });
- $carousel.css({height: height});
- }).on('init', function(event, slick, currentSlide, nextSlide){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- $(window).trigger('pix-parallax');
- }).slick({
- slide: 'li',
- prevArrow: $('button.post-list-prev', $carousel),
- nextArrow: $('button.post-list-next', $carousel),
- infinite: true,
- slidesToShow: $carousel.data('columns'),
- slidesToScroll: 1,
- swipeToSlide: true,
- dots: dots,
- responsive: responsive,
- adaptiveHeight: false
- });
- });
- });
- $('.post-list[data-grid="carousel"]').each(function(){
- var $carousel = $(this).imagesLoaded({ background: true }, function() {
- var responsive = [];
- if ( $carousel.data('landscape')!=='' ) {
- responsive.push({
- breakpoint: 1025,
- settings: {
- slidesToShow: $carousel.data('landscape')
- }
- });
- }
- if ( $carousel.data('portrait')!=='' ) {
- responsive.push({
- breakpoint: 769,
- settings: {
- slidesToShow: $carousel.data('portrait')
- }
- });
- }
- if ( $carousel.data('phone')!=='' ) {
- responsive.push({
- breakpoint: 415,
- settings: {
- slidesToShow: $carousel.data('phone')
- }
- });
- }
- $carousel.on('init beforeChange breakpoint reInit setPosition', function(event, slick, currentSlide, nextSlide){
- var height = 0;
- $('[aria-hidden="false"]', $carousel).each(function(){
- var thisH = $(this).outerHeight();
- if ( height < thisH ) {
- height = thisH;
- }
- });
- $carousel.css({height: height});
- }).on('init', function(event, slick, currentSlide, nextSlide){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- $(window).trigger('pix-parallax');
- }).slick({
- slide: 'article',
- prevArrow: $('button.post-list-prev', $carousel),
- nextArrow: $('button.post-list-next', $carousel),
- infinite: true,
- slidesToShow: $carousel.data('columns'),
- slidesToScroll: 1,
- swipeToSlide: true,
- responsive: responsive,
- adaptiveHeight: false
- });
- });
- });
- $('.testimonial-list[data-grid="carousel"]').each(function(){
- var $carousel = $(this).imagesLoaded({ background: true }, function() {
- var responsive = [];
- if ( $carousel.data('landscape')!=='' ) {
- responsive.push({
- breakpoint: 1025,
- settings: {
- slidesToShow: $carousel.data('landscape')
- }
- });
- }
- if ( $carousel.data('portrait')!=='' ) {
- responsive.push({
- breakpoint: 769,
- settings: {
- slidesToShow: $carousel.data('portrait')
- }
- });
- }
- if ( $carousel.data('phone')!=='' ) {
- responsive.push({
- breakpoint: 415,
- settings: {
- slidesToShow: $carousel.data('phone')
- }
- });
- }
- $carousel.on('init beforeChange breakpoint reInit setPosition', function(event, slick, currentSlide, nextSlide){
- var height = 0;
- $('[aria-hidden="false"]', $carousel).each(function(){
- var thisH = $(this).outerHeight();
- if ( height < thisH ) {
- height = thisH;
- }
- });
- $carousel.css({height: height});
- }).on('init', function(event, slick){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- $(window).trigger('pix-parallax');
- }).slick({
- slide: 'li',
- dots: true,
- prevArrow: false,
- nextArrow: false,
- infinite: true,
- slidesToShow: $carousel.data('columns'),
- slidesToScroll: 1,
- swipeToSlide: true,
- responsive: responsive,
- adaptiveHeight: false
- });
- });
- });
- $('.slick-carousel').each(function(){
- var $carousel = $(this).imagesLoaded({ background: true }, function() {
- var cols = typeof $carousel.attr('data-columns') != 'undefined' && $carousel.attr('data-columns') !== '' ? parseFloat( $carousel.attr('data-columns') ) : 1,
- dots = typeof $carousel.attr('data-dots') != 'undefined' && $carousel.attr('data-dots') !== '' && $carousel.attr('data-dots') == 'true' ? true : false,
- autoplay = typeof $carousel.attr('data-autoplay') != 'undefined' && $carousel.attr('data-autoplay') !== '' && $carousel.attr('data-autoplay') == 'true' ? true : false;
- var responsive = [];
- if ( $carousel.data('landscape')!=='' && $carousel.data('landscape')>0 ) {
- responsive.push({
- breakpoint: 1025,
- settings: {
- slidesToShow: $carousel.data('landscape')
- }
- });
- }
- if ( $carousel.data('portrait')!=='' && $carousel.data('portrait')>0 ) {
- responsive.push({
- breakpoint: 769,
- settings: {
- slidesToShow: $carousel.data('portrait')
- }
- });
- }
- if ( $carousel.data('phone')!=='' && $carousel.data('phone')>0 ) {
- responsive.push({
- breakpoint: 415,
- settings: {
- slidesToShow: $carousel.data('phone')
- }
- });
- }
- $carousel.on('init', function(event, slick, currentSlide, nextSlide){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- }).slick({
- dots: dots,
- autoplay: autoplay,
- slide: 'div',
- prevArrow: $('button.post-list-prev', $carousel),
- nextArrow: $('button.post-list-next', $carousel),
- infinite: true,
- slidesToShow: cols,
- slidesToScroll: 1,
- swipeToSlide: true,
- responsive: responsive,
- adaptiveHeight: true
- });
- });
- });
- $('.wpb_gallery_slidesslick').each(function(){
- var $carousel = $(this),
- dots = $carousel.attr('data-slick-dots') == 'yes',
- autoplay = $carousel.attr('data-slick-autoplay') == 'yes',
- arrows = $carousel.attr('data-slick-arrows') == 'yes',
- speed = $carousel.attr('data-slick-speed') == '' ? 5000 : parseFloat($carousel.attr('data-slick-speed'));
- $carousel.on('init', function(event, slick, currentSlide, nextSlide){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- $(window).trigger('pix-parallax');
- }).imagesLoaded({ background: true }, function() {
- $carousel.slick({
- fade: true,
- adaptiveHeight: true,
- dots: dots,
- arrows: arrows,
- autoplay: autoplay,
- autoplaySpeed: speed,
- });
- });
- });
- $('.slick-vc-carousel').each(function(){
- var $carousel = $(this),
- $parent = $(this).parents('.vc_slide').eq(0),
- speed = typeof $parent.attr('data-interval') != 'undefined' && $parent.attr('data-interval') !== '' ? parseFloat($parent.attr('data-interval')) : 5000,
- perview = typeof $parent.attr('data-per-view') != 'undefined' && $parent.attr('data-per-view') !== '' ? parseFloat($parent.attr('data-per-view')) : 1,
- loop = typeof $parent.attr('data-wrap') != 'undefined' && $parent.attr('data-wrap') !== '' ? $parent.attr('data-wrap') : true,
- autoplay = speed!='0',
- next = $('.vc_carousel-control', $parent).length ? $('button.post-list-next', $parent) : false,
- prev = $('.vc_carousel-control', $parent).length ? $('button.post-list-prev', $parent) : false,
- dots = $('.vc_carousel-indicators', $parent).length == 1,
- responsive = [];
- if ( $parent.data('landscape')!=='' ) {
- responsive.push({
- breakpoint: 1025,
- settings: {
- slidesToShow: $parent.data('landscape')
- }
- });
- }
- if ( $parent.data('portrait')!=='' ) {
- responsive.push({
- breakpoint: 769,
- settings: {
- slidesToShow: $parent.data('portrait')
- }
- });
- }
- if ( $parent.data('phone')!=='' ) {
- responsive.push({
- breakpoint: 415,
- settings: {
- slidesToShow: $parent.data('phone')
- }
- });
- }
- $carousel.on('init', function(event, slick, currentSlide, nextSlide){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- $(window).trigger('pix-parallax');
- }).imagesLoaded({ background: true }, function() {
- $carousel.slick({
- dots: dots,
- slide: 'div',
- prevArrow: prev,
- nextArrow: next,
- infinite: true,
- slidesToScroll: 1,
- swipeToSlide: true,
- adaptiveHeight: true,
- autoplaySpeed: speed,
- autoplay: autoplay,
- responsive: responsive,
- slidesToShow: perview
- });
- });
- });
- $('.vc_images_carousel').each(function(){
- var $parent = $(this),
- $carousel = $('.vc_carousel-slideline-inner', $parent),
- adaptiveHeight = $parent.attr('data-auto-height') == 'yes',
- dots = $parent.find('.vc_carousel-indicators').length > 0,
- autoplay = $parent.attr('data-interval') != '0',
- arrows = $parent.find('.vc_carousel-control').length > 0,
- speed = $parent.attr('data-interval') === '' ? 5000 : parseFloat($parent.attr('data-interval')),
- infinite = $parent.attr('data-wrap') == 'true',
- slidesToShow = $parent.attr('data-per-view') === '' ? 3 : parseFloat($parent.attr('data-per-view')),
- responsive = [];
- if ( $parent.data('landscape')!=='' ) {
- responsive.push({
- breakpoint: 1025,
- settings: {
- slidesToShow: $parent.data('landscape')
- }
- });
- }
- if ( $parent.data('portrait')!=='' ) {
- responsive.push({
- breakpoint: 769,
- settings: {
- slidesToShow: $parent.data('portrait')
- }
- });
- }
- if ( $parent.data('phone')!=='' ) {
- responsive.push({
- breakpoint: 415,
- settings: {
- slidesToShow: $parent.data('phone')
- }
- });
- }
- $carousel.imagesLoaded({ background: true }, function() {
- $carousel.on('init', function(event, slick, currentSlide, nextSlide){
- var marginLeft = parseFloat( $carousel.css('margin-left') );
- if ( marginLeft < 0 ) {
- var paddingLeft = marginLeft * -1;
- $('.slick-dots', $carousel).css({
- paddingLeft: paddingLeft
- });
- }
- Waypoint.refreshAll();
- $(window).trigger('pix-parallax');
- }).slick({
- adaptiveHeight: true,
- dots: dots,
- arrows: arrows,
- autoplay: autoplay,
- autoplaySpeed: speed,
- slidesToShow: slidesToShow,
- responsive: responsive,
- infinite: infinite
- });
- });
- });
- };
- MOOD.contentWrap = function() {
- var $entry = $('body.single-post #main .entry-content'),
- $block,
- contentClass;
- $entry.find('> *').each(function(){
- $block = $(this).not('.vc_row, .vc_row-full-width');
- if ( $block.hasClass('fullwidth') ) {
- contentClass = "content-wrap fullwidth";
- $block.wrap('<span class="' + contentClass + '" />');
- } else if ( $block.hasClass('threequarters') ) {
- contentClass = "content-wrap threequarters";
- $block.wrap('<span class="' + contentClass + '" />');
- } else if ( $block.hasClass('quote-wrap') ) {
- contentClass = "content-wrap advanced-quote";
- $block.wrap('<span class="' + contentClass + '" />');
- } else {
- contentClass = "content-wrap";
- $block.wrap('<span class="' + contentClass + '" />');
- }
- });
- $('.quote-wrap').each(function(){
- var $quoteWrap = $(this);
- if ( ! $quoteWrap.parents('.content-wrap.advanced-quote').length )
- $quoteWrap.wrap('<span class="content-wrap advanced-quote" />');
- var $wrap = $quoteWrap.parents('.content-wrap.advanced-quote').eq(0),
- $win = $(window),
- wrapW,
- winW,
- left,
- right,
- set;
- $wrap.after('<span class="content-wrap content-wrap-placeholder" />');
- var $holder = $wrap.next();
- var quoteSet = function(){
- winW = $win.width();
- wrapW = $holder.width();
- left = $holder.offset().left;
- right = winW - ( left + wrapW );
- $quoteWrap.css({
- marginLeft: (left * -1),
- marginRight: (right * -1),
- paddingLeft: left,
- paddingRight: right,
- width: winW
- });
- };
- quoteSet();
- $(window).on('resize orientationchange', function(){
- clearTimeout(set);
- set = setTimeout(quoteSet,10);
- });
- });
- };
- MOOD.stickySidebars = function() {
- var $body = $('body').addClass('sticked-sidebars'),
- $stick = $('#secondary, .stickit'),
- $header = $('header#masthead'),
- top = parseFloat( $header.attr('data-height') ),
- padding = parseFloat( $stick.css('padding-top') ) - 30;
- top = top - padding >= 0 ? top - padding : 0;
- if ( $body.hasClass('header-side') )
- top = 0;
- if ( $stick.length && mood_sticky_sidebars ) {
- if ( $body.hasClass('admin-bar') && $body.hasClass('logged-in') )
- top = top+32;
- var initStick = function(){
- $stick.not('.attached').stick_in_parent({
- offset_top: top
- }).on('sticky_kit:bottom', function(e) {
- $(this).parent().css('position', 'static');
- })
- .on('sticky_kit:unbottom', function(e) {
- $(this).parent().css('position', 'relative');
- }).addClass('attached');
- };
- $(window).on('resize load isotoped infinite-loaded', function() {
- setTimeout(function(){
- if ( $(window).width() <= 860 ) {
- $stick.removeClass('attached').trigger("sticky_kit:detach");
- } else {
- $(document.body).trigger("sticky_kit:recalc");
- initStick();
- }
- }, 100);
- });
- initStick();
- }
- };
- MOOD.title_section = function(){
- var $body = $('body'),
- $title = $('#header-title'),
- $parallax = $('#parrallax_wrap', $title),
- dataHeight = $('#header-title').attr('data-height'),
- $dataParax = $('[data-parallax]', $title),
- $spacer = $('#header-spacer'),
- spacerH,
- height,
- paraxH = 0,
- winH, set2;
- var initTitle = function(){
- if ( $parallax.length || ( typeof dataHeight != 'undefined' && dataHeight != '' && dataHeight != '0' ) ) {
- winH = $(window).height();
- spacerH = $spacer.outerHeight();
- if ( typeof dataHeight == 'undefined' || dataHeight == '' || dataHeight == '0' )
- dataHeight = 50;
- height = ( winH - spacerH ) * ( dataHeight / 100 );
- if ( $dataParax.length )
- paraxH = $dataParax.outerHeight();
- if ( $body.hasClass('admin-bar') && $body.hasClass('logged-in') )
- height = height-32;
- if ( height < paraxH )
- height = paraxH;
- height = height <= 414 ? 414 : height;
- $title.css({
- height: height
- });
- }
- };
- initTitle();
- var setTitle;
- $(window).on( 'resize', function(){
- clearTimeout(setTitle);
- setTitle = setTimeout(initTitle, 30);
- });
- if ( $('#header_ext_video iframe').length ) {
- var $extWrap = $('#header_ext_video'),
- extH, extW,
- $iframe = $extWrap.find('iframe');
- if ( $('#vimeo_title_player').length ) {
- var iframe = $('#vimeo_title_player')[0],
- player = $f(iframe);
- player.addEvent('loaded', function() {
- player.api('play')
- player.api('setVolume', 0);
- });
- }
- var iframeSize = function(){
- extW = $extWrap.outerWidth();
- extH = $extWrap.outerHeight();
- if ( 16 / 9 > extW / extH ) {
- $('iframe', $extWrap).css({
- width: ( extH )*(16/9),
- height: extH,
- left: ( ( extH )*(16/9) - extW ) / -2,
- top: 0
- });
- } else {
- $('iframe', $extWrap).css({
- width: extW,
- height: extW*(9/16),
- left: 0,
- top: ( extW*(9/16) - extH ) / -2
- });
- }
- };
- iframeSize();
- var setIframeSize;
- $(window).on( 'resize load', function(){
- clearTimeout(setIframeSize);
- setIframeSize = setTimeout(iframeSize, 30);
- });
- }
- var setTitleMaps = function(){
- if ($('.rwmb-map-canvas', $title).length ) {
- $('.rwmb-map-canvas', $title).each(function(){
- var titleH = $title.outerHeight(),
- $map = $(this).eq(0).height( titleH );
- google.maps.event.trigger($map.get(0), 'resize');
- });
- }
- $(window).trigger('pix-parallax');
- };
- setTitleMaps();
- $(window).on('resize', function(){
- clearTimeout(set2);
- set2 = setTimeout(setTitleMaps,250);
- });
- };
- MOOD.init_videos = function(){
- var $window = $(window),
- $page = $('#page');
- var resizeVideo = function(video) {
- var $section = video.parents('#header_parallax_bg').eq(0),
- h = video.attr('data-height'),
- w = video.attr('data-width');
- $section = !$section.length ? $window : $section;
- video.data('height',h);
- $window.on('resize resizevideo',function(){
- var secW = $section.outerWidth(),
- secH = $section.outerHeight(),
- rap = w/h,
- rap2 = h/w,
- newW = secH*rap,
- newH = secW*rap2,
- marginTop = newH-secH,
- marginLeft = newW-secW;
- secW = parseFloat(secW);
- secW = secW+2;
- secH = parseFloat(secH);
- newW = Math.floor(newW);
- newH = Math.floor(newH);
- marginTop = marginTop*-0.5;
- marginLeft = marginLeft*-0.5;
- var secRap = secW/secH;
- if(rap<secRap) {
- video.css({
- width: 'auto',
- height: newH,
- marginTop: marginTop,
- marginLeft: 0
- });
- } else {
- video.css({
- width: newW,
- height: 'auto',
- marginLeft: marginLeft,
- marginTop: 0
- });
- }
- }).triggerHandler('resizevideo');
- };
- $('video.pix_video').not('.init').each(function(){
- var video = $(this).addClass('init'),
- loop = typeof video.attr('data-loop')!='undefined' ? (video.attr('data-loop')=='true') : false,
- volume = typeof video.attr('data-volume')!='undefined' ? parseFloat(video.attr('data-volume')) : 1.0;
- video.bind("loadstart loadedmetadata", function () {
- var vidW = this.videoWidth;
- var vidH = this.videoHeight;
- video.attr('data-height',vidH).attr('data-width',vidW);
- //console.log(vidW,vidH);
- });
- var mediaInit = function(){
- video.mediaelementplayer({
- pauseOtherPlayers: false,
- loop: loop,
- success: function(mediaElement, domObject) {
- mediaElement.setVolume(volume);
- if ( video.attr('data-autoplay')=='true' ) {
- mediaElement.play();
- //$(video).parents('.pix_slideshine').data('loading',false);
- }
- var MEcanPlay = function(e){
- if ( video.hasClass('pix_section_video') ) {
- resizeVideo(video);
- }
- var domObj = $(domObject).parents('.mejs-container').eq(0).addClass('loaded');
- $('.isotope').isotope('layout');
- };
- mediaElement.addEventListener('canplay', MEcanPlay);
- var MEplay = function(){
- if ( video.parents('.slideshine_current').length ) {
- video.parents('.pix_slideshine').data('loading',false);
- }
- };
- mediaElement.addEventListener('play', MEplay);
- },
- error : function(mediaElement) {
- console.log('video error');
- }
- });
- };
- mediaInit();
- });
- };
- MOOD.fitVideos = function() {
- var manageVideoSize = function(){
- var setVideoFit;
- $('#container .featured-media[data-width][data-height]').each(function(){
- $this = $(this);
- if ( $('iframe', $this).length ) {
- var w = parseFloat($this.attr('data-width')),
- h = parseFloat($this.attr('data-height')),
- $iframe = $('> iframe, > a > iframe', $this),
- url = $iframe.attr('src'),
- ratio, frW;
- if ( typeof url != 'undefined' && url.indexOf('soundcloud') != -1 && h !== 0 ) {
- ratio = h / w;
- var resizeiFrame = function(){
- frW = $iframe.width();
- $iframe.css({
- height: frW * ratio
- });
- };
- resizeiFrame();
- $(window).on('resize load', resizeiFrame);
- } else if ( w !== 0 && h !== 0 ) {
- $iframe.attr('width',w).attr('height',h);
- }
- } else if ( $('video', $this).length ) {
- var $this = $(this),
- w = parseFloat($this.attr('data-width')),
- h = parseFloat($this.attr('data-height'));
- if ( w !== 0 && h !== 0 ) {
- var $video = $('video', $this),
- $container,
- actW,
- ratio = h / w;
- $video.on("readyState loadstart loadedmetadata", function () {
- var resideResidentVideo = function(){
- $container = $('.mejs-container:not(.mejs-container-fullscreen)', $this);
- actW = $container.width();
- $container.css({
- height: actW * ratio
- });
- $video.attr('width',actW).attr('height',(actW * ratio));
- $( document.body ).trigger('video-fit');
- };
- setTimeout(resideResidentVideo, 10);
- $(window).on('resize load', resideResidentVideo);
- });
- }
- }
- });
- $('#container').fitVids({ customSelector: "iframe[src^='https://videopress.com']"});
- };
- manageVideoSize();
- };
- MOOD.special_typography = function(){
- var $body = $('body'),
- $head = $('head'),
- $content = $('p.first-letter', $body),
- letter;
- $content.each(function(){
- letter = $(this).text().charAt(0);
- $(this).prepend('<span class="first-letter-clone">' + letter + '</span>');
- });
- $('.hor-lined').each(function(){
- var $lined = $(this),
- dataId = MOOD.guidGenerator();
- $lined.attr('data-id', dataId);
- if ( !$('.inner-hor-lined', $lined).length ) {
- var $this = $(this);
- $this.wrapInner('<span />').wrapInner('<span class="inner-hor-lined" />');
- }
- var color = $lined.css('color');
- $('<style>.hor-lined[data-id="' + dataId + '"] .inner-hor-lined::before, .hor-lined[data-id="' + dataId + '"] .inner-hor-lined::after{background-color:' + color + ' !important}</style>').appendTo($head);
- });
- };
- MOOD.pix_buttons = function(){
- var $button = $('.mood-button-wrap').has('.mood-button-separator');
- $button.each(function(){
- var $this = $(this),
- $sep = $('.mood-button-separator', $this),
- $first = $this.find('> a:first-child'),
- $second = $this.find('> a:last-child'),
- w = $sep.outerWidth(),
- set;
- var setSep = function(){
- w = $sep.css({
- width: 'auto'
- }).outerWidth();
- $sep.css({
- height: w,
- lineHeight: w+'px',
- marginLeft: (w/(-2)),
- marginTop: (w/(-2)),
- width: w
- });
- if ( mood_rtl ) {
- $second = $this.find('> a:first-child');
- $first = $this.find('> a:last-child');
- }
- $first.css({
- paddingRight: ((w/2)+20)
- });
- $second.css({
- paddingLeft: ((w/2)+20)
- });
- };
- setSep();
- $(window).on('resize load', function(){
- clearTimeout(set);
- set = setTimeout(setSep, 100);
- });
- });
- };
- MOOD.custom_tabs = function(){
- var $tabs = $('a[data-vc-accordion]').has('svg, .wpb_animate_when_almost_visible');
- $tabs.each(function(){
- var $this = $(this),
- icon = $this.html(),
- href = $this.attr('href');
- if ( $('a[data-vc-tabs][href="' + href + '"]:not(.vc_pagination-trigger)').length ) {
- $('a[data-vc-tabs][href="' + href + '"]:not(.vc_pagination-trigger)').html(icon);
- }
- });
- /* Google maps in tabs */
- $( ".vc_tta-tabs-list .vc_tta-tab > a" ).on( "click", function( event ) {
- setTimeout(function(){
- $(window).trigger('map-refresh');
- }, 500);
- });
- };
- MOOD.countdown = function(){
- $('.mood-countdown').each(function(){
- var $countdown = $(this),
- date = $countdown.attr('data-date'),
- format;
- $countdown.countdown(date, function(event) {
- format = '<span class="hours-wrap counter-wrap"><span class="hours-counter countdown-counter">%H</span><span class="hours-label countdown-label">' + mood_for_hours + '</span></span><span class="minutes-wrap counter-wrap"><span class="minutes-counter countdown-counter">%M</span><span class="minutes-label countdown-label">' + mood_for_minutes + '</span></span><span class="seconds-wrap counter-wrap"><span class="seconds-counter countdown-counter">%S</span><span class="seconds-label countdown-label">' + mood_for_seconds + '</span></span>';
- if(event.offset.days > 0)
- format = '<span class="days-wrap counter-wrap"><span class="days-counter countdown-counter">%-d</span><span class="days-label countdown-label">%!d:' + mood_for_day + ',' + mood_for_days + ';</span></span>' + format;
- if(event.offset.weeks > 0)
- format = '<span class="weeks-wrap counter-wrap"><span class="weeks-counter countdown-counter">%-w</span><span class="weeks-label countdown-label">%!w:' + mood_for_week + ',' + mood_for_weeks + ';</span></span>' + format;
- $(this).html(event.strftime(format));
- });
- });
- };
- MOOD.pricingTables = function(){
- $('.mood-pricing-table').each(function(){
- var $table = $(this),
- $column = $('.mood-pricing-column-wrap', $table),
- colAmount = parseFloat( $column.length ),
- maxWidth = ( 100 / colAmount ) + '%';
- $table.attr('data-cols', colAmount);
- $column.css({
- maxWidth: maxWidth
- });
- $column.matchHeight();
- if ( $table.hasClass( 'equal-height' ) )
- $column.find('> .mood-pricing-column > .mood-pricing-column-equalizer').matchHeight();
- $column.find('> .mood-pricing-column').matchHeight();
- });
- };
- MOOD.contactStyles = function(){
- $('.mood-cf7-styler').each(function(){
- var $contacts = $(this),
- $submit = $('p.mood-input-submit-inside', $contacts),
- $last, encloser, $encloser, subW, subH, set;
- if ( $contacts.hasClass('enclose-submit') && typeof $submit[0] != 'undefined' ) {
- $submit.replaceWith($('<span class="mood-input-submit-inside">' + $submit[0].innerHTML + '</span>'));
- $submit = $('span.mood-input-submit-inside', $contacts);
- encloser = $('<span class="encloser-submit" />');
- $last = $('p.mood-field-inside', $contacts).last().wrapInner( encloser );
- $encloser = $('.encloser-submit', $contacts);
- $submit.appendTo( $encloser );
- var setPadding = function(){
- if ( $(window).width() > 500 && $last.find('input:not([type="submit"])').length ) {
- if ( $last.hasClass( 'mood-textarea-inside' ) ) {
- subH = parseFloat( $('input', $submit).outerHeight() );
- $last.find('textarea').get(0).style.setProperty( 'padding-bottom', ( subH + 15 ) + 'px', 'important' );
- } else {
- subW = parseFloat( $('input', $submit).outerWidth() );
- $last.find('input:not([type="submit"])').get(0).style.setProperty( 'padding-right', ( subW + 15 ) + 'px', 'important' );
- }
- } else {
- if ( $last.hasClass( 'mood-textarea-inside' ) ) {
- $last.find('textarea').get(0).style.setProperty( 'padding-bottom', '1em', 'important' );
- } else {
- $last.find('input:not([type="submit"])').get(0).style.setProperty( 'padding-right', '1em', 'important' );
- }
- }
- };
- setPadding();
- $(window).on('resize', function(){
- clearTimeout(set);
- set = setTimeout(setPadding,10);
- });
- }
- });
- $('form.wpcf7-form').each(function(){
- var $form = $(this),
- $loader = $('.ajax-loader', $form);
- $form.append($loader);
- $(window).on('wpcf7:invalid wpcf7:mailsent wpcf7:mailfailed wpcf7:submit wpcf7:spam', function(){
- setTimeout(function(){
- $(window).trigger('resize');
- }, 500);
- });
- });
- };
- MOOD.svgGradient = function(){
- $('.mood-typo-separator').has('linearGradient').each(function(){
- var $el = $(this),
- $holder = $('> div', $el),
- holderW = parseFloat( $holder.width() ),
- $svg = $('svg', $el),
- svgW = parseFloat( $svg.width() ),
- $gradient = $('linearGradient', $svg),
- $stop = $('stop:last-child', $gradient),
- offset = parseFloat( $stop.attr('offset') ),
- newVal = ( holderW / svgW ) * 100;
- $stop.attr('offset', newVal + '%');
- });
- };
- MOOD.fitText = function(){
- var overText = function(){
- $('.text-position-over, .text-position-hover').addClass('over-text').each(function(){
- var $block = $(this),
- blockH,
- blockW,
- $text = $('.entry-text', $block),
- textH,
- textW,
- newSize = 1;
- $block.data('newSize', newSize);
- $block.css('font-size', false);
- var overTextLoop = function(){
- blockH = $block.height();
- textH = $text.outerHeight();
- blockW = $block.width();
- textW = $text.outerWidth();
- newSize = $block.data('newSize');
- if ( blockH < textH || blockW < textW ) {
- newSize = newSize - 0.01;
- $block.data('newSize', newSize);
- $block.css({
- fontSize: newSize+'em'
- })
- setTimeout( overTextLoop, 10 );
- }
- }
- overTextLoop();
- });
- };
- var set;
- overText();
- $(window).on('resize', function(){
- clearTimeout(set);
- set = setTimeout(overText,10);
- });
- $('h1, h2, h3, h4, h5, h6, blockquote, .fitText').filter(':notparents(.over-text)').moodFitText();
- };
- MOOD.footerFixed = function(){
- var $window = $(window),
- $body = $('body'),
- $footer = $('footer#colophon'),
- $masthead = $('header#masthead'),
- mastH,
- $title = $('header#header-title'),
- titleH,
- $container = $('#container'),
- contH,
- $page = $('#page'),
- winH,
- footH,
- set;
- var setFooter = function(){
- if ( $footer.hasClass('fixed-footer') ) {
- winH = $window.height();
- footH = $footer.outerHeight();
- mastH = $masthead.outerHeight();
- titleH = $title.outerHeight();
- contH = $container.outerHeight();
- if ( winH < footH || ( mastH + titleH + contH ) < winH || ( $body.hasClass('mood-boxed-layout') && $body.hasClass('header-side') ) ) {
- $footer.removeClass('just-fixed');
- $page.css({ marginBottom: 0 });
- } else {
- $footer.addClass('just-fixed');
- $page.css({ marginBottom: footH });
- }
- } else {
- $footer.removeClass('just-fixed');
- $page.css({ marginBottom: 0 });
- }
- };
- setFooter();
- $(window).on('load', setFooter);
- $(window).on('resize', function(){
- clearTimeout(set);
- set = setTimeout(setFooter,10);
- });
- };
- MOOD.mediaElementAdjust = function(){
- var runAdjust = function(){
- $('.wp-audio-playlist').each(function(){
- var $elem = $(this),
- $items = $('.wp-playlist-item', $elem),
- $prev = $('.wp-playlist-prev', $elem),
- $next = $('.wp-playlist-next', $elem);
- if ( $items.length < 2 ) {
- $prev.hide();
- $next.hide();
- }
- });
- };
- runAdjust();
- $('body').ajaxSuccess(function() {
- runAdjust();
- });
- };
- MOOD.init = function(){
- MOOD.childrenInviewport();
- MOOD.product_quickview();
- MOOD.smoothScroll();
- MOOD.mainNavigation();
- MOOD.overlayMenu();
- MOOD.searchOverlay();
- MOOD.stickyNav();
- MOOD.mobileMenu();
- MOOD.vcParallax();
- MOOD.parallax();
- MOOD.parallaxEls();
- MOOD.revSliders();
- MOOD.verticalTitles();
- MOOD.infiniteScroll();
- MOOD.initColorbox();
- MOOD.zoomImage();
- MOOD.productImageCarousel();
- MOOD.resetVariations();
- MOOD.accordion();
- MOOD.sharingWindows();
- MOOD.contentWrap();
- MOOD.stickySidebars();
- MOOD.title_section();
- MOOD.init_videos();
- MOOD.fitVideos();
- MOOD.special_typography();
- MOOD.pix_buttons();
- MOOD.custom_tabs();
- MOOD.countdown();
- MOOD.contactStyles();
- MOOD.svgGradient();
- MOOD.fitText();
- MOOD.inviewportMob();
- MOOD.footerFixed();
- $('#page').imagesLoaded({ background: true }, function() {
- MOOD.postSliders();
- MOOD.pricingTables();
- MOOD.masonry();
- MOOD.mediaElementAdjust();
- setTimeout(function(){
- MOOD.inviewport();
- }, 500);
- });
- var setResize, checkDevice = 'check-' + $('body').hasClass('mobile-view');
- $(window).on('resize', function() {
- clearTimeout(setResize);
- if ( checkDevice == 'check-' + $('body').hasClass('mobile-view') )
- return;
- setResize = setTimeout(function(){
- MOOD.inviewport();
- MOOD.inviewportMob();
- checkDevice = 'check-' + $('body').hasClass('mobile-view');
- }, 500);
- });
- };
- $(function(){
- MOOD.init();
- });
- })(jQuery);
- function mood_hide_reply(elem){
- var $body = jQuery('body');
- $body.data('replybutton',elem);
- jQuery('.comment-reply-link').removeClass('hidden');
- jQuery(elem).addClass('hidden');
- }
- window.vc_waypoints = function () {
- return;
- };
- //wp-content/plugins/js_composer/assets/js/js_composer_front.js - lines 580-670
- window.vc_rowBehaviour = function () {
- var $ = window.jQuery;
- function localFunction() {
- var $elements = $( '[data-vc-full-width="true"]' );
- $.each( $elements, function ( key, item ) {
- var $wrap = $('#page').length ? $('#page') : $( window );//used a selector if available instead of $( window ) //pixedelic
- var $el = $( this );
- //$el.addClass( 'vc_hidden' );
- var $el_full = $el.next( '.vc_row-full-width' );
- var el_margin_left = parseInt( $el.css( 'margin-left' ), 10 );
- var el_margin_right = parseInt( $el.css( 'margin-right' ), 10 );
- var wrap_offset = $wrap.offset().left;//added the offset of the wrap
- var offset = wrap_offset - $el_full.offset().left - el_margin_left;//added wrap_offset instead of 0
- var width = $wrap.width();//used $wrap instead of $( window )
- $el.css( {
- 'position': 'relative',
- 'left': offset,
- 'box-sizing': 'border-box',
- 'width': $wrap.width()//pixedelic
- } );
- if ( ! $el.data( 'vcStretchContent' ) ) {
- var padding = (- 1 * offset);
- if ( 0 > padding ) {
- padding = 0;
- }
- var paddingRight = width - padding - $el_full.width() + el_margin_left + el_margin_right;
- if ( 0 > paddingRight ) {
- paddingRight = 0;
- }
- $el.css( { 'padding-left': padding + 'px', 'padding-right': paddingRight + 'px' } );
- }
- $el.attr( "data-vc-full-width-init", "true" );
- //$el.removeClass( 'vc_hidden' );
- $( document.body ).trigger('vc-full-width-row');
- $(window).trigger('map-refresh');
- } );
- }
- /**
- * @todo refactor as plugin.
- * @returns {*}
- */
- function fullHeightRow() {
- $( '.vc_row:first:not(.relative_min_height)' ).each( function () {
- if ( ! $(this).hasClass('vc_row-o-full-height') || $('#header-title').length )
- return false;
- var $window,
- windowHeight,
- offsetTop,
- fullHeight;
- $window = $( window );
- windowHeight = $window.height();
- offsetTop = $( this ).offset().top;
- if ( offsetTop < windowHeight ) {
- fullHeight = 100 - offsetTop / (windowHeight / 100);
- $( this ).css( 'min-height', fullHeight + 'vh' );
- }
- } );
- }
- function fixIeFlexbox() {
- var ua = window.navigator.userAgent;
- var msie = ua.indexOf("MSIE ");
- if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)){
- $( '.vc_row-o-full-height' ).each( function () {
- if ($( this ).css( 'display') === 'flex') {
- $( this ).wrap('<div class="vc_ie-flexbox-fixer"></div>')
- }
- } );
- }
- }
- $( window ).unbind( 'resize.vcRowBehaviour' ).bind( 'resize.vcRowBehaviour', localFunction );
- $( window ).bind( 'resize.vcRowBehaviour', fullHeightRow );
- localFunction();
- fullHeightRow();
- fixIeFlexbox();
- initVideoBackgrounds(); // must be called before parallax
- //parallaxRow();
- };
- /* This javascript goes with the likeThis plugin written by Rosemarie Pritchard.
- http://lifeasrose.ca
- */
- var $j = jQuery.noConflict();
- function likeScript(){
- function reloadLikes(who) {
- var text = $j("#" + who).text();
- var patt= /(\d)+/;
- var num = patt.exec(text);
- num[0]++;
- text = text.replace(patt,num[0]);
- $j("#" + who).text(text);
- } //reloadLikes
- $j(".likeThis").click(function() {
- var classes = $j(this).attr("class");
- classes = classes.split(" ");
- if(classes[1] == "done") {
- return false;
- }
- var classes = $j(this).addClass("done");
- var id = $j('.likes-amount',this).attr("data-id");
- id = id.split("like-");
- $j.ajax({
- type: "POST",
- url: homeurl+'/index.php',
- data: "likepost=" + id[1],
- success: reloadLikes("like-" + id[1])
- });
- return false;
- });
- }
- $j(document).ready(function(){
- likeScript();
- $j('body').ajaxSuccess(function() {
- likeScript();
- });
- });
Add Comment
Please, Sign In to add comment