"use strict"; // Accordion function irecco_accordion_init() { var item = jQuery('.wgl-accordion'); item.each( function() { var header = jQuery(this).find('.wgl-accordion_header'); var content = jQuery(this).find('.wgl-accordion_content'); var acc_type = jQuery(this).data('type'); var speed = 400; header.off("click"); header.each( function() { if (jQuery(this).data('default') == 'yes') { jQuery(this).addClass('active'); jQuery(this).next().slideDown(speed); } }) header.on('click', function(e) { e.preventDefault(); var $this = jQuery(this); if ( acc_type == 'accordion' ) { $this.toggleClass('active'); $this.next().slideToggle(speed); } else if ( acc_type == 'toggle' ) { $this.toggleClass('active'); $this.next().slideToggle(speed); content.not($this.next()).slideUp(speed); header.not($this).removeClass('active'); } }) }) } // Services Accordion function irecco_services_accordion_init() { var item_module = jQuery('.wgl-accordion-services'); item_module.each( function() { var item = jQuery(this).find('.wgl-services_item'); jQuery(this).find('.wgl-services_item:first-child').addClass('active'); item.on('hover', function(e) { jQuery(this).addClass('active').siblings().removeClass('active'); }) }) } (function($) { jQuery(document).ready(function() { irecco_ajax_load(); }); function irecco_ajax_load() { var i, section; var sections = document.getElementsByClassName('wgl_cpt_section'); for (i = 0; i < sections.length; i++) { section = sections[i]; irecco_ajax_init(section); } } var wait_load = false; var offset_items = 0; var infinity_item; var js_offset; function irecco_ajax_query(grid, section, request_data) { if (wait_load) return; wait_load = true; request_data['offset_items'] = request_data.js_offset ? request_data.js_offset : offset_items; request_data['items_load'] = request_data.items_load; request_data['js_offset'] = request_data.js_offset ? request_data.js_offset : offset_items; $.post( wgl_core.ajaxurl, { action: 'wgl_ajax', data: request_data }, function(response, status) { var resp, new_items, load_more_hidden, count_products; resp = document.createElement('div'); resp.innerHTML = response; new_items = $('.item', resp); count_products = $('.woocommerce-result-count', resp); load_more_hidden = $('.hidden_load_more', resp); if (load_more_hidden.length) { jQuery(section) .find('.load_more_wrapper') .fadeOut(300, function() { $(this).remove(); }); } else { jQuery(section) .find('.load_more_wrapper .load_more_item') .removeClass('loading'); } jQuery(section) .find('.woocommerce-result-count') .html(jQuery(count_products).html()); if ($(grid).hasClass('carousel')) { $(grid) .find('.slick-track') .append(new_items); $(grid) .find('.slick-dots') .remove(); $(grid) .find('.wgl-carousel_slick') .slick('reinit'); } else if ($(grid).hasClass('grid')) { new_items = new_items.hide(); $(grid).append(new_items); new_items.fadeIn('slow'); } else { var items = jQuery(new_items); jQuery(grid) .imagesLoaded() .always(function() { jQuery(grid) .append(items) .isotope('appended', items) .isotope('reloadItems'); setTimeout(function() { jQuery(grid).isotope('layout'); irecco_scroll_animation(); updateFilter(); }, 500); }); } // Call vc waypoint settings if (typeof jQuery.fn.waypoint === 'function') { jQuery(grid) .find( '.wpb_animate_when_almost_visible:not(.wpb_start_animation)' ) .waypoint( function() { jQuery(this).addClass('wpb_start_animation animated'); }, { offset: '100%' } ); } //Call video background settings if (typeof jarallax === 'function') { irecco_parallax_video(); } else { jQuery.getScript(wgl_core.JarallaxPluginVideo, function() { jQuery .getScript(wgl_core.JarallaxPlugin, function() {}) .always(function(s, Status) { jQuery(grid) .find('.parallax-video') .each(function() { jQuery(this).jarallax({ loop: true, speed: 1, videoSrc: jQuery(this).data('video'), videoStartTime: jQuery(this).data('start'), videoEndTime: jQuery(this).data('end') }); }); }); }); } //Call slick settings if ( jQuery(grid) .find('.wgl-carousel_slick') .size() > 0 ) { jQuery.getScript(wgl_core.slickSlider).always(function(s, Status) { jQuery(grid) .find('.wgl-carousel_slick') .each(function() { destroyCarousel(jQuery(this)); slickCarousel(jQuery(this)); if (jQuery(grid).hasClass('blog_masonry')) { jQuery(grid).isotope('layout'); } }); }); } irecco_scroll_animation(); //Update Items var offset_data = $('.js_offset_items', resp); request_data.js_offset = parseInt(offset_data.data('offset')); wait_load = false; } ); } function irecco_ajax_init(section) { offset_items = 0; var grid, form, data_field, data, request_data, load_more; //if Section CPT return if (section == undefined) return; //Get grid CPT grid = section.getElementsByClassName('container-grid'); if (!grid.length) return; grid = grid[0]; //Get form CPT form = section.getElementsByClassName('posts_grid_ajax'); if (!form.length) return; form = form[0]; //Get field form ajax data_field = form.getElementsByClassName('ajax_data'); if (!data_field.length) return; data_field = data_field[0]; data = data_field.value; data = JSON.parse(data); request_data = data; //Add pagination offset_items += request_data.post_count; infinity_item = section.getElementsByClassName('infinity_item'); if (infinity_item.length) { infinity_item = infinity_item[0]; if (jQuery(infinity_item).is_visible()) { irecco_ajax_query(grid, section, request_data); } var lastScrollTop = 0; jQuery(window).on('resize scroll', function() { if (jQuery(infinity_item).is_visible()) { var st = jQuery(this).scrollTop(); if (st > lastScrollTop) { irecco_ajax_query(grid, section, request_data); } lastScrollTop = st; } }); } load_more = section.getElementsByClassName('load_more_item'); if (load_more.length) { load_more = load_more[0]; load_more.addEventListener( 'click', function(e) { e.preventDefault(); jQuery(this).addClass('loading'); irecco_ajax_query(grid, section, request_data); }, false ); } } function slickCarousel(grid) { jQuery(grid).slick({ draggable: true, fade: true, speed: 900, cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)', touchThreshold: 100 }); } function destroyCarousel(grid) { if (jQuery(grid).hasClass('slick-initialized')) { jQuery(grid).slick('destroy'); } } function updateFilter() { jQuery('.isotope-filter a').each(function() { var data_filter = this.getAttribute('data-filter'); var num = jQuery(this) .closest('.wgl-portfolio') .find('.wgl-portfolio-list_item') .filter(data_filter).length; jQuery(this) .find('.number_filter') .text(num); }); } })(jQuery); function irecco_scroll_animation(){ var portfolio = jQuery('.wgl-portfolio_container'); var shop = jQuery('.wgl-products.appear-animation'); //Scroll Animation (function($) { var docElem = window.document.documentElement; function getViewportH() { var client = docElem['clientHeight'], inner = window['innerHeight']; if( client < inner ) return inner; else return client; } function scrollY() { return window.pageYOffset || docElem.scrollTop; } // http://stackoverflow.com/a/5598797/989439 function getOffset( el ) { var offsetTop = 0, offsetLeft = 0; do { if ( !isNaN( el.offsetTop ) ) { offsetTop += el.offsetTop; } if ( !isNaN( el.offsetLeft ) ) { offsetLeft += el.offsetLeft; } } while( el = el.offsetParent ) return { top : offsetTop, left : offsetLeft } } function inViewport( el, h ) { var elH = el.offsetHeight, scrolled = scrollY(), viewed = scrolled + getViewportH(), elTop = getOffset(el).top, elBottom = elTop + elH, h = h || 0; return (elTop + elH * h) <= viewed && (elBottom - elH * h) >= scrolled; } function extend( a, b ) { for( var key in b ) { if( b.hasOwnProperty( key ) ) { a[key] = b[key]; } } return a; } function AnimOnScroll( el, options ) { this.el = el; this.options = extend( this.defaults, options ); if(this.el.length){ this._init(); } } AnimOnScroll.prototype = { defaults : { viewportFactor : 0 }, _init : function() { this.items = Array.prototype.slice.call( jQuery(this.el ).children() ); this.itemsCount = this.items.length; this.itemsRenderedCount = 0; this.didScroll = false; this.delay = 100; var self = this; if(typeof imagesLoaded === 'function'){ imagesLoaded( this.el, this._imgLoaded(self)); }else{ this._imgLoaded(self); } }, _imgLoaded : function(self) { var interval; // the items already shown... self.items.forEach( function( el, i ) { if( inViewport( el ) ) { self._checkTotalRendered(); if(!jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport( el, self.options.viewportFactor )){ self._item_class(jQuery(el), self.delay, interval ); self.delay += 200; setTimeout( function() { self.delay = 100; }, 200 ); } } } ); // animate on scroll the items inside the viewport window.addEventListener( 'scroll', function() { self._onScrollFn(); }, false ); window.addEventListener( 'resize', function() { self._resizeHandler(); }, false ); }, _onScrollFn : function() { var self = this; if( !this.didScroll ) { this.didScroll = true; setTimeout( function() { self._scrollPage(); }, 60 ); } }, _item_class : function(item_array, delay, interval) { interval = setTimeout(function(){ if ( item_array.length) { jQuery(item_array).addClass( 'animate' ); } else { clearTimeout( interval ); } }, delay); }, _scrollPage : function() { var self = this; var interval; this.items.forEach( function( el, i ) { if( !jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport( el, self.options.viewportFactor ) ) { setTimeout( function() { var perspY = scrollY() + getViewportH() / 2; self._checkTotalRendered(); self._item_class(jQuery(el), self.delay, interval); self.delay += 200; setTimeout( function() { self.delay = 100; }, 200 ); }, 25 ); } }); this.didScroll = false; }, _resizeHandler : function() { var self = this; function delayed() { self._scrollPage(); self.resizeTimeout = null; } if ( this.resizeTimeout ) { clearTimeout( this.resizeTimeout ); } this.resizeTimeout = setTimeout( delayed, 1000 ); }, _checkTotalRendered : function() { ++this.itemsRenderedCount; if( this.itemsRenderedCount === this.itemsCount ) { window.removeEventListener( 'scroll', this._onScrollFn ); } } } // add to global namespace window.AnimOnScroll = AnimOnScroll; })(jQuery); new AnimOnScroll( portfolio, {} ); new AnimOnScroll( shop, {} ); } // Scroll Up button function irecco_scroll_up() { (function($) { $.fn.goBack = function (options) { var defaults = { scrollTop: jQuery(window).height(), scrollSpeed: 600, fadeInSpeed: 1000, fadeOutSpeed: 500 }; var options = $.extend(defaults, options); var $this = $(this); $(window).on('scroll', function () { if ($(window).scrollTop() > options.scrollTop) { $this.addClass('active'); } else { $this.removeClass('active'); } }) $this.on('click', function () { $('html,body').animate({ 'scrollTop': 0 }, options.scrollSpeed) }) } })(jQuery); jQuery('#scroll_up').goBack(); }; function irecco_blog_masonry_init () { if (jQuery(".blog_masonry").length) { var blog_dom = jQuery(".blog_masonry").get(0); var $grid = imagesLoaded( blog_dom, function() { // initialize masonry jQuery(".blog_masonry").isotope({ layoutMode: 'masonry', masonry: { columnWidth: '.item', }, itemSelector: '.item', percentPosition: true }); jQuery(window).trigger('resize'); }); } } // wgl Carousel List function irecco_carousel_slick() { var carousel = jQuery('.wgl-carousel_slick'); if (carousel.length !== 0 ) { carousel.each( function(item, value) { if (jQuery(this).hasClass('slick-initialized')) { jQuery(this).slick('destroy'); } if (jQuery(this).hasClass('fade_slick')) { jQuery(this).slick({ draggable: true, fade: true, speed: 900, cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)', touchThreshold: 100 }); } else { jQuery(this).slick({}); } }); } } function irecco_circuit_services() { if (jQuery('.irecco_module_circuit_services').length) { jQuery('.irecco_module_circuit_services').each(function(){ var $circle = jQuery(this).find('.services_item-icon'); var agle = 360 / $circle.length; var agleCounter = -1; $circle.each(function() { var $this = jQuery(this); jQuery(this).parents('.services_item-wrap:first-child').addClass('active'); $this.on('hover', function(){ jQuery(this).parents('.services_item-wrap').addClass('active').siblings().removeClass('active'); }) var percentWidth = (100 * parseFloat($this.css('width')) / parseFloat($this.parent().css('width'))); var curAgle = agleCounter * agle; var radAgle = curAgle * Math.PI / 180; var x = (50 + ((50 - (percentWidth / 2)) * Math.cos(radAgle))) - (percentWidth / 2); var y = (50 + ((50 - (percentWidth / 2)) * Math.sin(radAgle))) - (percentWidth / 2); $this.css({ left: x + '%', top: y + '%' }); agleCounter++; }); }); } } function irecco_circuit_services_resize (){ if (jQuery('.irecco_module_circuit_services').length) { setTimeout(function(){ jQuery('.irecco_module_circuit_services').each(function(){ var $this = jQuery(this); var wwidth = $this.width(); if (wwidth < 370){ $this.removeClass('tablet_resp').addClass('mobile_resp'); } else if (wwidth < 460) { $this.removeClass('mobile_resp').addClass('tablet_resp'); } else { $this.removeClass('tablet_resp mobile_resp'); } }); }, 1); } } /*! * JavaScript Cookie v2.2.0 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ ;(function (factory) { var registeredInModuleLoader; if (typeof define === 'function' && define.amd) { define(factory); registeredInModuleLoader = true; } if (typeof exports === 'object') { module.exports = factory(); registeredInModuleLoader = true; } if (!registeredInModuleLoader) { var OldCookies = window.Cookies; var api = window.Cookies = factory(); api.noConflict = function () { window.Cookies = OldCookies; return api; }; } }(function () { function extend () { var i = 0; var result = {}; for (; i < arguments.length; i++) { var attributes = arguments[ i ]; for (var key in attributes) { result[key] = attributes[key]; } } return result; } function decode (s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function init (converter) { function api() {} function set (key, value, attributes) { if (typeof document === 'undefined') { return; } attributes = extend({ path: '/' }, api.defaults, attributes); if (typeof attributes.expires === 'number') { attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); } // We're using "expires" because "max-age" is not supported by IE attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; try { var result = JSON.stringify(value); if (/^[\{\[]/.test(result)) { value = result; } } catch (e) {} value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)) .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); key = encodeURIComponent(String(key)) .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) .replace(/[\(\)]/g, escape); var stringifiedAttributes = ''; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue; } stringifiedAttributes += '; ' + attributeName; if (attributes[attributeName] === true) { continue; } // Considers RFC 6265 section 5.2: // ... // 3. If the remaining unparsed-attributes contains a %x3B (";") // character: // Consume the characters of the unparsed-attributes up to, // not including, the first %x3B (";") character. // ... stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; } return (document.cookie = key + '=' + value + stringifiedAttributes); } function get (key, json) { if (typeof document === 'undefined') { return; } var jar = {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. var cookies = document.cookie ? document.cookie.split('; ') : []; var i = 0; for (; i < cookies.length; i++) { var parts = cookies[i].split('='); var cookie = parts.slice(1).join('='); if (!json && cookie.charAt(0) === '"') { cookie = cookie.slice(1, -1); } try { var name = decode(parts[0]); cookie = (converter.read || converter)(cookie, name) || decode(cookie); if (json) { try { cookie = JSON.parse(cookie); } catch (e) {} } jar[name] = cookie; if (key === name) { break; } } catch (e) {} } return key ? jar[key] : jar; } api.set = set; api.get = function (key) { return get(key, false /* read as raw */); }; api.getJSON = function (key) { return get(key, true /* read as json */); }; api.remove = function (key, attributes) { set(key, '', extend(attributes, { expires: -1 })); }; api.defaults = {}; api.withConverter = init; return api; } return init(function () {}); })); // wgl Countdown function init function irecco_countdown_init () { var countdown = jQuery('.wgl-countdown'); if (countdown.length !== 0 ) { countdown.each(function () { var data_atts = jQuery(this).data('atts'); var time = new Date(+data_atts.year, +data_atts.month-1, +data_atts.day, +data_atts.hours, +data_atts.minutes); jQuery(this).countdown({ until: time, padZeroes: true, digits: [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ], format: data_atts.format ? data_atts.format : 'yowdHMS', labels: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2],data_atts.labels[3],data_atts.labels[4],data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]], labels1: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2], data_atts.labels[3], data_atts.labels[4], data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]] }); }); } } // wgl Counter function irecco_counter_init() { var counters = jQuery('.wgl-counter'); if ( counters.length ) { counters.each(function() { var counter = jQuery(this).find('.wgl-counter_value-wrap .wgl-counter_value.value-placeholder'); counter.appear(function() { var max = jQuery(this).data('end-value'), from = jQuery(this).data('start-value'), speed = jQuery(this).data('speed'); counter.countTo({ from: from, to: max, speed: speed, refreshInterval: 10 }); }); }); } } function irecco_dynamic_styles(){ var style = jQuery('#irecco-footer-inline-css'); (function($) { $.fn.wglAddDynamicStyles = function() { if (this.length === 0) { return this; } return this.each(function () { var $style = '', self = jQuery(this); var init = function() { $style += self.text(); self.remove(); appendStyle(); }, appendStyle = function(){ jQuery('head').append(''); }; /*Init*/ init(); }); }; })(jQuery); style.wglAddDynamicStyles(); } //https://gist.github.com/chriswrightdesign/7955464 function mobilecheck() { var check = false; (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); return check; } //Add Click event for the mobile device var click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click'; function initClickEvent(){ click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click'; } jQuery(window).on('resize', initClickEvent); /* ** Plugin for counter shortcode */ (function($) { "use strict"; $.fn.countTo = function(options) { // merge the default plugin settings with the custom options options = $.extend({}, $.fn.countTo.defaults, options || {}); // how many times to update the value, and how much to increment the value on each update var loops = Math.ceil(options.speed / options.refreshInterval), increment = (options.to - options.from) / loops; return $(this).each(function() { var _this = this, loopCount = 0, value = options.from, interval = setInterval(updateTimer, options.refreshInterval); function updateTimer() { value += increment; loopCount++; $(_this).html(value.toFixed(options.decimals)); if (typeof(options.onUpdate) === 'function') { options.onUpdate.call(_this, value); } if (loopCount >= loops) { clearInterval(interval); value = options.to; if (typeof(options.onComplete) === 'function') { options.onComplete.call(_this, value); } } } }); }; $.fn.countTo.defaults = { from: 0, // the number the element should start at to: 100, // the number the element should end at speed: 1000, // how long it should take to count between the target numbers refreshInterval: 100, // how often the element should be updated decimals: 0, // the number of decimal places to show onUpdate: null, // callback method for every time the element is updated, onComplete: null // callback method for when the element finishes updating }; })(jQuery); /* ** Plugin for slick Slider */ function irecco_slick_navigation_init (){ jQuery.fn.irecco_slick_navigation = function (){ jQuery(this).each( function (){ var el = jQuery(this); jQuery(this).find('span.left_slick_arrow').on("click", function() { jQuery(this).closest('.wgl_cpt_section').find('.slick-prev').trigger('click'); }); jQuery(this).find('span.right_slick_arrow').on("click", function() { jQuery(this).closest('.wgl_cpt_section').find('.slick-next').trigger('click'); }); }); } } /* ** Plugin IF visible element */ function is_visible_init (){ jQuery.fn.is_visible = function (){ var elementTop = jQuery(this).offset().top; var elementBottom = elementTop + jQuery(this).outerHeight(); var viewportTop = jQuery(window).scrollTop(); var viewportBottom = viewportTop + jQuery(window).height(); return elementBottom > viewportTop && elementTop < viewportBottom; } } /* ** Preloader */ jQuery(window).load(function(){ jQuery('#preloader-wrapper').fadeOut(); }); // wgl image comparison function irecco_image_comparison () { var item = jQuery('.wgl-image_comparison.cocoen'); if (item.length !== 0 ) { item.each(function(){ jQuery(this).cocoen(); }); } } // wgl Image Layers function irecco_img_layers() { jQuery('.wgl-image-layers').each(function() { var container = jQuery(this); var initImageLayers = function(){ container.appear(function() { container.addClass('img-layer_animate'); },{done:true}) } initImageLayers(); // jQuery(window).on('resize', initImageLayers); // jQuery(window).on('load', initImageLayers); }); } function irecco_isotope () { if (jQuery(".isotope").length) { var portfolio_dom = jQuery(".isotope").get(0); var $grid = imagesLoaded( portfolio_dom, function() { // initialize masonry var mode = jQuery(".isotope").hasClass('fit_rows') ? 'fitRows' : 'masonry'; jQuery(".isotope").isotope({ layoutMode: mode, percentPosition: true, itemSelector: '.wgl-portfolio-list_item, .item', masonry: { columnWidth: '.wgl-portfolio-list_item-size, .wgl-portfolio-list_item, .item', } }).isotope( 'layout' ); jQuery(window).trigger('resize'); }); jQuery(".isotope-filter a").each(function(){ var data_filter = this.getAttribute("data-filter"); var num = jQuery(this).closest('.wgl-portfolio').find('.wgl-portfolio-list_item').filter( data_filter ).length; jQuery(this).find('.number_filter').text( num ); }); var $filter = jQuery(".isotope-filter a"); $filter.on("click", function (e){ e.preventDefault(); jQuery(this).addClass("active").siblings().removeClass("active"); var filterValue = jQuery(this).attr('data-filter'); jQuery(this).closest('.wgl_cpt_section').find('.isotope').isotope({ filter: filterValue }); }); } } function irecco_menu_lavalamp(){ var lavalamp = jQuery('.menu_line_enable > ul'); if (lavalamp.length !== 0) { lavalamp.each(function(){ var $this = jQuery(this); $this.lavalamp({ easing: 'easeInOutCubic', duration: 600, }); }); } } (function($, window) { var Lavalamp = function(element, options) { this.element = $(element).data('lavalamp', this); this.options = $.extend({}, this.options, options); this.init(); }; Lavalamp.prototype = { options: { current: '.current-menu-ancestor,.current-menu-item,.current-category-ancestor', items: 'li', bubble: '
', animation: false, blur: $.noop, focus: $.noop, duration: 600, }, easing: 'ease', // Easing transition duration: 700, // Duration of animation element: null, current: null, bubble: null, _focus: null, init: function() { var resizeTimer, self = this, child = self.element.children('li'); this.onWindowResize = function() { if (resizeTimer) { clearTimeout(resizeTimer); } resizeTimer = setTimeout(function() { self.reload(); }, 100); }; $(window).bind('resize.lavalamp', this.onWindowResize); $(child).addClass('lavalamp-item'); this.element .on('mouseenter.lavalamp', '.lavalamp-item' , function() { self.current.each(function() { self.options.blur.call(this, self); }); self._move($(this)); }) .on('mouseleave.lavalamp', function() { if (self.current.index(self._focus) < 0) { self._focus = null; self.current.each(function() { self.options.focus.call(this, self); }); self._move(self.current); } }); this.bubble = $.isFunction(this.options.bubble) ? this.options.bubble.call(this, this.element) : $(this.options.bubble).prependTo(this.element); self.element.addClass('lavalamp'); self.element.find('.lavalamp-object').addClass(self.options.easing); this.reload(); self.element.addClass("lavalamp_animate") }, reload: function() { this.current = this.element.children(this.options.current); if (this.current.size() === 0) { this.current = this.element.children().not('.lavalamp-object').eq(0); } this._move(this.current, false); }, destroy: function() { if (this.bubble) { this.bubble.remove(); } this.element.unbind('.lavalamp'); $(window).unbind('resize.lavalamp', this.onWindowResize); }, _move: function(el, animate) { var pos = el.position(); pos.left = pos.left + parseInt(el.children('a').css('paddingLeft')) var properties = { transform: 'translate('+pos.left+'px,'+pos.top+'px)', width: '25px', }; this._focus = el; // Check for CSS3 animations if(this.bubble.css('opacity') === "0"){ this.bubble.css({ WebkitTransitionProperty: "opacity", msTransitionProperty: "opacity", MozTransitionProperty: "opacity", OTransitionProperty: "opacity", transitionProperty: "opacity", WebkitTransitionDuration: '0s', msTransitionDuration: '0s', MozTransitionDuration: '0s', OTransitionDuration: '0s', transitionDuration: '0s', }); }else{ this.bubble.css({ WebkitTransitionProperty: "all", msTransitionProperty: "all", MozTransitionProperty: "all", OTransitionProperty: "all", transitionProperty: "all", WebkitTransitionDuration: this.options.duration / 1000 + 's', msTransitionDuration: this.options.duration / 1000 + 's', MozTransitionDuration: this.options.duration / 1000 + 's', OTransitionDuration: this.options.duration / 1000 + 's', transitionDuration: this.options.duration / 1000 + 's', }) } this.bubble.css(properties); } }; $.fn.lavalamp = function(options) { if (typeof options === 'string') { var instance = $(this).data('lavalamp'); return instance[options].apply(instance, Array.prototype.slice.call(arguments, 1)); } else { return this.each(function() { var instance = $(this).data('lavalamp'); if (instance) { $.extend(instance.options, options || {}); instance.reload(); } else { new Lavalamp(this, options); } }); } }; })(jQuery, window); (function( $ ) { $(document).on('click', '.sl-button', function() { var button = $(this); var post_id = button.attr('data-post-id'); var security = button.attr('data-nonce'); var iscomment = button.attr('data-iscomment'); var allbuttons; if ( iscomment === '1' ) { /* Comments can have same id */ allbuttons = $('.sl-comment-button-'+post_id); } else { allbuttons = $('.sl-button-'+post_id); } var loader = allbuttons.next('#sl-loader'); if (post_id !== '') { $.ajax({ type: 'POST', url: wgl_core.ajaxurl, data : { action : 'irecco_like', post_id : post_id, nonce : security, is_comment : iscomment, }, beforeSend:function(){ loader.html('