/** * Isotope v1.5.25 * An exquisite jQuery plugin for magical layouts * http://isotope.metafizzy.co * * Commercial use requires one-time purchase of a commercial license * http://isotope.metafizzy.co/docs/license.html * * Non-commercial use is licensed under the MIT License * * Copyright 2013 Metafizzy */ (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e"+d+"{#modernizr{height:3px}}"+"").appendTo("head"),f=b('
').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[j],r=h("transitionDuration"));var s=b.event,t=b.event.handle?"handle":"dispatch",u;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",u&&clearTimeout(u),u=setTimeout(function(){s[t].apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var v=["width","height"],w=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=v.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;fg?1:f0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){this.$allAtoms=this.$allAtoms.not(a),this.$filteredAtoms=this.$filteredAtoms.not(a);var c=this,d=function(){a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),w.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;id&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;id&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var x=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){x("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){x("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery); jQuery(document).ready(function($){ // **********************************************************************// // ! 8theme Mega Search // **********************************************************************// $.fn.etMegaSearch = function ( options ) { var et_search = $(this); var form = et_search.find('form'); var input = form.find('input[type="text"]'); var resultArea = et_search.find('.et-search-result'); var close = et_search.find('.et-close-results'); input.keyup(function() { if($(this).val() == '' || $(this).val().length < 3) { et_search.removeClass('loading result-exist'); return; } data = 's='+$(this).val() + '&products=' + et_search.data('products') + '&count=' + et_search.data('count') + '&images=' + et_search.data('images') + '&posts=' + et_search.data('posts') + '&portfolio=' + et_search.data('portfolio') + '&pages=' + et_search.data('pages') + '&action=et_get_search_result'; et_search.addClass('loading'); resultArea.html(''); $.ajax({ url: myAjax.ajaxurl, method: 'GET', data: data, dataType: 'JSON', error: function(data) { console.log('AJAX error'); }, success : function(data){ if(data.results) { et_search.addClass('result-exist'); } else { et_search.removeClass('result-exist'); } resultArea.html(data.html); }, complete : function() { et_search.removeClass('loading'); } }); }); close.click(function() { et_search.removeClass('result-exist'); }); return this; } $('.et-mega-search').each(function(){ $(this).etMegaSearch(); }); // **********************************************************************// // ! Media Elements with JS // **********************************************************************// jQuery('video:not(.et-section-video)').mediaelementplayer({ success: function(player, node) { jQuery('#' + node.id + '-mode').html('mode: ' + player.pluginType); } }); // **********************************************************************// // ! Countdown // **********************************************************************// $.fn.countdown = function ( options ) { var settings = $.extend({ type: "default" }, options ); setInterval(function countdown_update() { var countdown = $('.et-timer'); var eventDate = Date.parse(countdown.data('final')) / 1000; var currentDate = Math.floor($.now() / 1000); var days = countdown.find('.days'); var hours = countdown.find('.hours'); var minutes = countdown.find('.minutes'); var seconds = countdown.find('.seconds'); var remindSeconds = eventDate-currentDate; if(remindSeconds > 0) { var remindDays = Math.floor(remindSeconds / (60 * 60 * 24)); remindSeconds -= remindDays * 60 * 60 * 24; var remindHours = Math.floor(remindSeconds / (60 * 60)); remindSeconds -= remindHours * 60 * 60; var remindMinutes = Math.floor(remindSeconds / (60)); remindSeconds -= remindMinutes * 60; if(remindDays < 10) remindDays = '0' + remindDays; if(remindHours < 10) remindHours = '0' + remindHours; if(remindMinutes < 10) remindMinutes = '0' + remindMinutes; if(remindSeconds < 10) remindSeconds = '0' + remindSeconds; if(days < 1 || remindDays == '00') { days.parent().hide().next().hide(); } else { days.text(remindDays); } hours.text(remindHours); minutes.text(remindMinutes); seconds.text(remindSeconds); } }, 1000); return this; } $('.et-timer').countdown(); // **********************************************************************// // ! Promo popup // **********************************************************************// var et_popup_closed = $.cookie('etheme_popup_closed'); $('.etheme-popup').magnificPopup({ type: 'inline', preloader: false, focus: '#username', modal: true }); if(et_popup_closed != 'do-not-show') { $('.etheme-popup').click(); } $(document).on('click', '.popup-modal-dismiss', function (e) { e.preventDefault(); $.magnificPopup.close(); if($('#showagain:checked').val() == 'do-not-show') $.cookie('etheme_popup_closed', 'do-not-show', { expires: 1, path: '/' } ); }); // **********************************************************************// // ! Images lightbox // **********************************************************************// $("a[rel^='lightboxGall']").magnificPopup({ type:'image', gallery:{ enabled:true } }); $("a[rel='lightbox']").magnificPopup({ type:'image' }); // **********************************************************************// // ! Mobile loader // **********************************************************************// $('.mobile-loader > div').fadeOut(300); $('.mobile-loader').delay(300).fadeOut(800, function(){ $('.mobile-loader').remove(); }); // **********************************************************************// // ! Product images sections loading // **********************************************************************// $('.single-product-page .images').addClass('shown'); // **********************************************************************// // ! Animated Counters // **********************************************************************// function animateCounter(el) { var initVal = parseInt(el.text()); var finalVal = el.data('value'); if(finalVal <= initVal) return; var intervalTime = 1; var time = 200; var step = parseInt((finalVal - initVal)/time.toFixed()); if(step < 1) { step = 1; time = finalVal - initVal; } var firstAdd = (finalVal - initVal)/step - time; var counter = parseInt((firstAdd*step).toFixed()) + initVal; var i = 0; var interval = setInterval(function(){ i++; counter = counter + step; el.text(counter); if(i == time) { clearInterval(interval); } }, intervalTime); } // **********************************************************************// // ! Full width section // **********************************************************************// function et_sections(){ $('.et_section').each(function(){ $(this).css({ 'left': - ($(window).width() - $('.header > .container').width())/2, 'width': $(window).width(), 'visibility': 'visible' }); var videoTag = $(this).find('.section-back-video video'); videoTag.css({ 'width': $(window).width(), //'height': $(window).width() * videoTag.height() / videoTag.width() }); }); } et_sections() $(window).resize(function(){ et_sections(); }) // **********************************************************************// // ! Hidden Top Panel // **********************************************************************// $(function(){ var topPanel = $('.top-panel'); var pageWrapper = $('.page-wrapper'); var showPanel = $('.show-top-panel'); var panelHeight = topPanel.outerHeight(); showPanel.toggle(function(){ $(this).addClass('show-panel'); pageWrapper.attr('style','transform: translateY('+panelHeight+'px);-ms-transform: translateY('+panelHeight+'px);-webkit-transform: translateY('+panelHeight+'px);'); topPanel.addClass('show-panel'); },function(){ pageWrapper.attr('style','') topPanel.removeClass('show-panel'); $(this).removeClass('show-panel'); }); }); // **********************************************************************// // ! Remove some br and p // **********************************************************************// $('.toggle-element ~ br').remove(); $('.toggle-element ~ p').remove(); $('.block-with-ico h5').next('p').remove(); $('.tab-content .row-fluid').next('p').remove(); $('.tab-content .row-fluid').prev('p').remove(); // **********************************************************************// // ! Update Favicon // **********************************************************************// function et_update_favicon() { var itemsCount = $('.cart-summ').data('items-count'); var enableBadge = $('.shopping-cart-widget').data('fav-badge'); var favicon = new Favico({ animation : 'popFade', fontStyle : 'normal', }); if (enableBadge == 'enable') { favicon.badge(itemsCount); } } et_update_favicon(); // **********************************************************************// // ! Fade animations // **********************************************************************// setTimeout(function() { $('.fade-in').removeClass('fade-in'); }, 500); // **********************************************************************// // ! Products grid images slider // **********************************************************************// function contentProdImages() { $('.hover-effect-slider').each(function() { var slider = $(this); var index = 0; var autoSlide; var imageLink = slider.find('.product-content-image'); var imagesList = imageLink.data('images-list'); imagesList = imagesList.split(","); var arrowsHTML = '
left
right
'; var counterHTML = '
1/' + imagesList.length + '
'; if(imagesList.length > 1) { slider.prepend(arrowsHTML); slider.prepend(counterHTML); // Previous image on click on left arrow slider.find('.arrow-left').click(function(event) { if(index > 0) { index--; } else { index = imagesList.length-1; // if the first item set it to last } imageLink.find('img').attr('src', imagesList[index]); // change image src slider.find('.current-index').text(index + 1); // update slider counter }); // Next image on click on left arrow slider.find('.arrow-right').click(function(event) { if(index < imagesList.length - 1) { index++; } else { index = 0; // if the last image set it to first } imageLink.find('img').attr('src', imagesList[index]);// change image src slider.find('.current-index').text(index + 1);// update slider counter }); } }); } contentProdImages(); // **********************************************************************// // ! Wishlist // **********************************************************************// $('.yith-wcwl-add-button.show').each(function(){ var wishListText = $(this).find('a').text(); $(this).find('a').attr('data-hover',wishListText); }); // **********************************************************************// // ! Main Navigation plugin // **********************************************************************// $.fn.et_menu = function ( options ) { var methods = { showChildren: function(el) { el.fadeIn(100).css({ display: 'list-item', listStyle: 'none' }).find('li').css({listStyle: 'none'}); }, calculateColumns: function(el) { // calculate columns count var columnsCount = el.find('.container > ul > li.menu-item-has-children').length; var dropdownWidth = el.find('.container > ul > li').outerWidth(); var padding = 20; if(columnsCount > 1) { dropdownWidth = dropdownWidth*columnsCount + padding; el.css({ 'width':dropdownWidth }); } // calculate right offset of the dropdown var headerWidth = $('.menu-wrapper').outerWidth(); var headerLeft = $('.menu-wrapper').offset().left; var dropdownOffset = el.offset().left - headerLeft; var dropdownRight = headerWidth - (dropdownOffset + dropdownWidth); if(dropdownRight < 0) { el.css({ 'left':'auto', 'right':0 }); } }, openOnClick: function(el,e) { var timeOutTime = 0; var openedClass = "current"; var header = $('.header-wrapper'); var $this = el; if($this.parent().hasClass(openedClass)) { e.preventDefault(); $this.parent().removeClass(openedClass); $this.next().stop().slideUp(settings.animTime); header.stop().animate({'paddingBottom': 0}, settings.animTime); } else { if($this.parent().find('>div').length < 1) { return; } e.preventDefault(); if($this.parent().parent().find('.' + openedClass).length > 0) { timeOutTime = settings.animTime; header.stop().animate({'paddingBottom': 0}, settings.animTime); } $this.parent().parent().find('.' + openedClass).removeClass(openedClass).find('>div').stop().slideUp(settings.animTime); setTimeout(function(){ $this.parent().addClass(openedClass); header.stop().animate({'paddingBottom': $this.next().height()+50},settings.animTime); $this.next().stop().slideDown(settings.animTime); },timeOutTime); } } }; var settings = $.extend({ type: "default", // can be columns, default, mega, combined animTime: 250, openByClick: true }, options ); if(settings.type == 'mega') { this.find('>li>a').click(function(e) { methods.openOnClick($(this),e); }); return this; } this.find('>li').hover(function (){ if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { if(settings.openByClick) { $('.open-by-click.current').find('>a').click(); $(this).find('>a').unbind('click'); } var dropdown = $(this).find('> .nav-sublist-dropdown'); methods.showChildren(dropdown); if(settings.type == 'columns') { methods.calculateColumns(dropdown); } } else { $(this).find('>a').unbind('click'); $(this).find('>a').bind('click', function(e) { methods.openOnClick($(this),e); }); } }, function () { if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { $(this).find('> .nav-sublist-dropdown').fadeOut(100).attr('style', ''); } }); return this; } // First Type of column Menu $('.main-nav .menu').et_menu({ type: "default" }); $('.fixed-header .menu').et_menu({ openByClick: false }); function et_equalize_height(elements, removeHeight) { var heights = []; if(removeHeight) { elements.attr('style', ''); } elements.each(function(){ heights.push($(this).height()); }); var maxHeight = Math.max.apply( Math, heights ); if($(window).width() > 767) { elements.height(maxHeight); } } $(window).resize(function(){ //et_equalize_height($('.product-category'), true); }); // **********************************************************************// // ! "Top" button // **********************************************************************// var scroll_timer; var displayed = false; var $message = jQuery('.back-to-top'); jQuery(window).scroll(function () { window.clearTimeout(scroll_timer); scroll_timer = window.setTimeout(function () { if(jQuery(window).scrollTop() <= 0) { displayed = false; $message.removeClass('btt-shown'); } else if(displayed == false) { displayed = true; $message.stop(true, true).addClass('btt-shown').click(function () { $message.removeClass('btt-shown'); }); } }, 400); }); jQuery('.back-to-top').click(function(e) { jQuery('html, body').animate({scrollTop:0}, 600); return false; }); // **********************************************************************// // ! Portfolio // **********************************************************************// $portfolio = $('.masonry'); $portfolio.each(function() { var portfolioGrid = $(this); portfolioGrid.isotope({ itemSelector: '.portfolio-item' }); $(window).smartresize(function(){ portfolioGrid.isotope({ itemSelector: '.portfolio-item' }); }); portfolioGrid.parent().find('.portfolio-filters a').click(function(){ var selector = $(this).attr('data-filter'); portfolioGrid.parent().find('.portfolio-filters a').removeClass('active'); if(!$(this).hasClass('active')) { $(this).addClass('active'); } portfolioGrid.isotope({ filter: selector }); return false; }); }); setTimeout(function(){ $('.portfolio').addClass('with-transition'); $('.portfolio-item').addClass('with-transition'); $(window).resize(); },500); // **********************************************************************// // ! Blog isotope // **********************************************************************// $blog = $('.blog-masonry'); $blog.isotope({ itemSelector: '.post-grid' }); $('.copyright .logo-small').click(function(){ var $newItems = $(''); $blog.isotope( 'insert', $newItems ); }); $(window).smartresize(function(){ $blog.isotope({ itemSelector: '.post-grid' }); }); $('body').on('click', '.load-more-posts a', function(e){ e.preventDefault(); var url = $(this).attr('href'); if($(this).length>0) { et_add_blog_posts(url); $loading = true; } }); var $loading = false; $(window).scroll(function(){ var $window = $(window); var $element = $('.load-more-posts'); if($element.length>0) { var pos = $window.scrollTop(); windowHeight = $window.height(); var top = $element.offset().top; var height = $element.height(); var viewportBottom = pos + windowHeight; // Check if totally above or totally below viewport if (top + height < pos || top > viewportBottom) { return; } var url = $element.find('a').attr('href'); if($element.find('a').length>0) { et_add_blog_posts(url); $loading = true; } } }); function et_add_blog_posts(url){ if($loading) return; $.ajax({ url: url, method: 'GET', timeout: 10000, dataType: 'text', beforeSend: function() { $('.load-more-posts').addClass('loading'); }, success: function(data) { $('.blog-masonry').addClass('with-transition'); $('.post-grid').addClass('with-transition'); $('.blog-masonry').isotope( 'insert', $(data).find('.blog-masonry .post-grid') ); $('.load-more-posts').html($(data).find('.load-more-posts').html()); }, error: function(data) { console.log('Error loading ajax content!'); window.location.reload(); }, complete: function() { setTimeout(function(){ $(window).resize(); },100); setTimeout(function(){ $loading = false; },500); $('.load-more-posts').removeClass('loading'); } }); return; } // **********************************************************************// // ! Other elements isotope // **********************************************************************// $container = $('.isotope-container'); $isotope = $('.et_isotope'); $isotope.each(function() { var isotope = $(this); isotope.isotope({ itemSelector: '.et_isotope-item' }); $(window).smartresize(function(){ isotope.isotope({ itemSelector: '.et_isotope-item' }); }); setTimeout(function(){ isotope.addClass('with-transition'); isotope.find('.et_isotope-item').addClass('with-transition'); $(window).resize(); },500); }); $container.each(function() { var container = $(this); var isotope = container.find('.et_isotope'); container.find('.et_categories_filter a').data('isotope', isotope).click(function(e){ e.preventDefault(); var isotope = jQuery(this).data('isotope'); jQuery(this).parent().parent().find('.active').removeClass('active'); jQuery(this).addClass('active'); isotope.isotope({filter: jQuery(this).attr('data-filter')}); }); }); // **********************************************************************// // ! Fixed header // **********************************************************************// $(window).scroll(function(){ if (!$('body').hasClass('fixNav-enabled')) {return false; } var fixedHeader = $('.fixed-header-area'); var scrollTop = $(this).scrollTop(); var headerHeight = $('.header-wrapper').height() + 20; if(scrollTop > headerHeight){ if(!fixedHeader.hasClass('fixed-already')) { fixedHeader.stop().addClass('fixed-already'); } }else{ if(fixedHeader.hasClass('fixed-already')) { fixedHeader.stop().removeClass('fixed-already'); } } }); // **********************************************************************// // ! Icons Preview // **********************************************************************// var modalDiv = $('#iconModal'); $('.demo-icons .demo-icon').click(function(){ var name = $(this).find('i').attr('class'); modalDiv.find('i').each(function(){ $(this).attr('class',name); }); modalDiv.find('#myModalLabel').text(name); modalDiv.modal(); }); // **********************************************************************// // ! Testimonials Gallery // **********************************************************************// $('.testimonials-slider').cbpQTRotator(); // **********************************************************************// // ! WooCommerce // **********************************************************************// // **********************************************************************// // ! Remove from cart with AJAX // **********************************************************************// $(document.body).on('click', '.cart-popup .delete-btn, .shopping-cart .product-remove a', function(e){ e.preventDefault(); var $this = $(this); var key = $this.data('key'); $.ajax({ method: "POST", url: woocommerce_params.ajax_url, data: { 'action': 'et_remove_from_cart', 'key' : key }, error: function() { console.log('removing from cart AJAX error'); }, success: function(response) { $('#cartModal').replaceWith(response.fragments.cart_modal); $('.shopping-cart-widget').replaceWith(response.fragments.top_cart); et_update_favicon(); $this.parent().parent().remove(); $('.success').remove(); $('table.cart').before('

' + response.msg + 'close

'); } }); }); // **********************************************************************// // ! Products view switcher // **********************************************************************// function listSwitcher() { var activeClass = 'switcher-active'; var gridClass = 'products-grid'; var listClass = 'products-list'; jQuery('.switchToList').click(function(){ if(!jQuery.cookie('products_page') || jQuery.cookie('products_page') == 'grid'){ switchToList(); } }); jQuery('.switchToGrid').click(function(){ if(!jQuery.cookie('products_page') || jQuery.cookie('products_page') == 'list'){ switchToGrid(); } }); function switchToList(){ jQuery('.switchToList').addClass(activeClass); jQuery('.switchToGrid').removeClass(activeClass); jQuery('.product-loop').fadeOut(300,function(){ jQuery(this).removeClass(gridClass).addClass(listClass).fadeIn(300); jQuery.cookie('products_page', 'list', { expires: 3, path: '/' }); }); } function switchToGrid(){ jQuery('.switchToGrid').addClass(activeClass); jQuery('.switchToList').removeClass(activeClass); jQuery('.product-loop').fadeOut(300,function(){ jQuery(this).removeClass(listClass).addClass(gridClass).fadeIn(300); jQuery.cookie('products_page', 'grid', { expires: 3, path: '/' }); }); } } function check_view_mod(){ var activeClass = 'switcher-active'; if(jQuery.cookie('products_page') == 'grid') { jQuery('.product-loop').removeClass('products-list').addClass('products-grid'); jQuery('.switchToGrid').addClass(activeClass); }else if(jQuery.cookie('products_page') == 'list') { jQuery('.product-loop').removeClass('products-grid').addClass('products-list'); jQuery('.switchToList').addClass(activeClass); }else{ if(view_mode_default == 'list_grid' || view_mode_default == 'list') { jQuery('.switchToList').addClass(activeClass); }else{ jQuery('.switchToGrid').addClass(activeClass); } } } listSwitcher(); check_view_mod(); // **********************************************************************// // ! Checkout login form // **********************************************************************// $('a.showlogin').click(function(){ $('form.et_login').slideToggle(); return false; }); // **********************************************************************// // ! Step by step checkout // **********************************************************************// var stepsNav = $('.checkout-steps-nav'); var steps = $('.checkout-steps'); var nextStepBtn = $('.continue-checkout'); stepsNav.find('li a').click(function(e) { e.preventDefault(); var link = $(this); var stepId = link.data('step'); showStep(stepId); }); nextStepBtn.click(function(e) { e.preventDefault(); var nextId = $(this).data('next'); showStep(nextId); }); steps.find('.active').show(); // checkout method var radioBtns = $('input[name="method"]'); radioBtns.change(function() { var checkedMethod = jQuery(this).val(); checkMethod(checkedMethod); }); checkMethod($('input[name="method"]:checked').val()); function showStep(id) { var stepsNav = $('.checkout-steps-nav'); $('.checkout-step').fadeOut(200); stepsNav.find('li a').removeClass('active filled'); for(var i = id; i>0; i--) { $('#tostep' + i + ' a').addClass('filled'); } $('#tostep' + id + ' a').addClass('active'); setTimeout(function(){ $('#step' + id).fadeIn(200); }, 200); } function checkMethod(val){ if(val == 2) { $('#tostep2').css('display','inline-block'); $('#createaccount').attr('checked', true); $('#step1 .continue-checkout').data('next',2); }else{ $('#tostep2').hide(); $('#createaccount').attr('checked', false); $('#step1 .continue-checkout').data('next',3); } } /* Ajax Filter */ function ajaxProductLoad(url,blockId) { $.ajax({ url: url, method: 'GET', timeout: 10000, dataType: 'text', success: function(data) { productLoaded(data,blockId); }, error: function(data) { alert('Error loading ajax content!'); window.location.reload(); } }); } function productLoaded(data,blockId) { //hide spinner $('.woocommerce-pagination').html($(data).find('.woocommerce-pagination').html()); for(var i=0; i
'); ajaxProductLoad(url,blockId); event.stopPropagation(); return false; }); } // Ajax add to cart var modalWindow = jQuery('.etheme-simple-product').eModal(); $('.etheme-simple-product').live('click', function(e) { e.preventDefault(); // AJAX add to cart request var $thisbutton = $(this); if ($thisbutton.is('.etheme-simple-product, .product_type_downloadable, .product_type_virtual')) { $('#top-cart').addClass('updating'); formAction = $('form.cart').attr('action'); var data = $('form.cart').serializeArray(); modalWindow.eModal('showModal'); // Trigger event $('body').trigger('adding_to_cart'); // Ajax action $.ajax({ url: formAction, data: data, method: 'POST', timeout: 10000, dataType: 'text', error: function(data) { modalWindow.eModal('endLoading') .eModal('addError', 'Error with ajax') .eModal('addBtn',{ title: contBtn, href: 'javascript:void(0);', cssClass: 'button small hidewindow', hideOnClick: true }); }, success : function(data,statusText,xhr ) { jQuery('.shopping-cart-widget').html(jQuery(data).find('.shopping-cart-widget').html()); jQuery('.cart-totals').html(jQuery(data).find('.cart-totals').html()); jQuery('#shopping-cart-modal').html(jQuery(data).find('#shopping-cart-modal').html()); et_update_favicon(); if($('.thumbnails img').length > 0) { productImageSrc = $('.thumbnails img').first().attr('src'); } else { productImageSrc = $('.main-image-slider img').first().attr('src'); } productName = $('.product_title').first().text(); modalWindow.eModal('endLoading') .eModal('setTitle',productName) .eModal('addImage', productImageSrc) .eModal('addText', successfullyAdded) .eModal('addBtn',{ title: contBtn, href: 'javascript:void(0);', cssClass: 'button small hidewindow', hideOnClick: true }) .eModal('addBtn',{ title: checkBtn, href: checkoutUrl, cssClass: 'button filled active small arrow-right' }); } }); return false; } else { return true; } }); // Ajax add to cart (on list page) $('.etheme_add_to_cart_button').live('click', function() { // AJAX add to cart request var $thisbutton = $(this); if ($thisbutton.is('.product_type_simple, .product_type_downloadable, .product_type_virtual')) { if (!$thisbutton.attr('data-product_id')) return true; $thisbutton.removeClass('added'); $thisbutton.parent().parent().addClass('loading'); $thisbutton.after('
'); var data = { action: 'et_woocommerce_add_to_cart', product_id: $thisbutton.attr('data-product_id'), quantity: 1 }; // Trigger event $('body').trigger( 'adding_to_cart', [ $thisbutton, data ] ); // Ajax action $.post( woocommerce_params.ajax_url, data, function( response ) { if ( ! response ) return; var this_page = window.location.toString(); this_page = this_page.replace( 'add-to-cart', 'added-to-cart' ); if ( response.error && response.product_url ) { window.location = response.product_url; return; } // Redirect to cart option if ( woocommerce_params.cart_redirect_after_add == 'yes' ) { window.location = woocommerce_params.cart_url; return; } else { $thisbutton.parent().find('#floatingCirclesG').remove(); fragments = response.fragments; cart_hash = response.cart_hash; // Changes button classes $thisbutton.addClass('added').parent().prepend('
' + successfullyAdded + '
'); setTimeout(function() { $thisbutton.parent().parent().removeClass('loading'); $thisbutton.removeClass('added'); $('.added-text').fadeOut(300); }, 3000) // Cart widget load et_update_favicon(); $('#cartModal').replaceWith(fragments.cart_modal); $('.shopping-cart-widget').replaceWith(fragments.top_cart); $('.cart-totals').replaceWith(fragments.cart_totals); $('body').trigger('cart_widget_refreshed'); // Trigger event so themes can refresh other areas $('body').trigger( 'added_to_cart', [ fragments, cart_hash ] ); } }); return false; } else { return true; } }); // **********************************************************************// // ! AJAX Quick View // **********************************************************************// $(document.body).on('click', '.show-quickly, .show-quickly-btn', (function() { var $thisbutton = $(this); var prodid = $thisbutton.data('prodid'); var magnificPopup; $.ajax({ url: woocommerce_params.ajax_url, method: 'POST', data: { 'action': 'et_product_quick_view', 'prodid': prodid }, dataType: 'html', beforeSend: function() { $thisbutton.parent().parent().addClass('loading'); $thisbutton.after('
'); }, complete: function() { $thisbutton.parent().find('#floatingCirclesG').remove(); $thisbutton.parent().parent().removeClass('loading'); }, success: function(response){ $.magnificPopup.open({ items: { src: '
' + response + '
' }, type: 'inline', removalDelay: 500, //delay removal by X to allow out-animation callbacks: { beforeOpen: function() { this.st.mainClass = 'mfp-zoom-in-to-left-out'; } } }, 0); $(function() { $('.variations_form').wc_variation_form(); $('.variations_form .variations select').change(); }); $('.images').addClass('shown'); }, error: function() { $.magnificPopup.open({ items: { src: '
Error with AJAX request
' }, type: 'inline', removalDelay: 500, //delay removal by X to allow out-animation callbacks: { beforeOpen: function() { this.st.mainClass = 'mfp-zoom-in-to-left-out'; } } }, 0); } }); })); // **********************************************************************// // ! Search form // **********************************************************************// var searchBlock = $('.search.hide-input'); var searchForm = searchBlock.find('#searchform'); var searchBtn = searchForm.find('.button'); var searchInput = searchForm.find('input[type="text"]'); searchBtn.click(function(e) { e.preventDefault(); searchInput.fadeIn(200).focus(); $('body').addClass('search-input-shown'); // Hide search input on click $(document).click(function(e) { var target = e.target; if (!$(target).is('.search.hide-input') && !$(target).parents().is('.search.hide-input')) { searchInput.fadeOut(200); $('body').removeClass('search-input-shown'); } }); }); // **********************************************************************// // ! Tabs // **********************************************************************// var tabs = $('.tabs'); $('.tabs > p > a').unwrap('p'); var leftTabs = $('.left-bar, .right-bar'); var newTitles; leftTabs.each(function(){ var currTab = $(this); //currTab.find('> a.tab-title').each(function(){ newTitles = currTab.find('> a.tab-title').clone().removeClass('tab-title').addClass('tab-title-left'); //}); newTitles.first().addClass('opened'); var tabNewTitles = $('
').prependTo(currTab); tabNewTitles.html(newTitles); currTab.find('.tab-content').css({ 'minHeight' : tabNewTitles.height() }); }); tabs.each(function(){ var currTab = $(this); currTab.find('.tab-title').first().addClass('opened').next().show(); currTab.find('.tab-title, .tab-title-left').click(function(e){ e.preventDefault(); var tabId = $(this).attr('id'); if($(this).hasClass('opened')){ if(currTab.hasClass('accordion') || $(window).width() < 767){ $(this).removeClass('opened'); $('#content_'+tabId).hide(); } }else{ currTab.find('.tab-title, .tab-title-left').each(function(){ var tabId = $(this).attr('id'); $(this).removeClass('opened'); $('#content_'+tabId).hide(); }); if(currTab.hasClass('accordion') || $(window).width() < 767){ $('#content_'+tabId).removeClass('tab-content').show(); setTimeout(function(){ $('#content_'+tabId).addClass('tab-content').show(); // Fix it },1); } else { $('#content_'+tabId).show(); } $(this).addClass('opened'); } }); }); /* * Variations images changes * to make it work properly comment in woocommerce/assets/js/frontend/add-to-cart-variation.js * this.unbind( 'check_variations update_variation_values found_variation' ); */ $('form.variations_form').on( 'found_variation', function( event, variation ) { var $variation_form = $(this); var $product = $(this).closest( '.product' ); var $product_img = $product.find( 'a#main-zoom-image img:eq(0)' ); var $product_link = $product.find( 'a#main-zoom-image' ); $product_link.attr('data-o_href',$product_link.attr('href')); var o_src = $product_img.attr('data-o_src'); var o_title = $product_img.attr('data-o_title'); var o_href = $product_link.attr('data-o_href'); var variation_image = variation.image_src; var variation_link = variation.image_link; var variation_title = variation.image_title; $('.woocommerce-main-image').attr('href', variation_image); if ($('.main-image-slider').hasClass('zoom-enabled')) { console.log(variation_image); console.log(variation_link); if($(window).width() > 768 && variation_image.length > 5 && variation_link.length > 5){ $('a#main-zoom-image').swinxyzoom('load', variation_image, variation_link); } $('a#main-zoom-image').attr('href', variation_link); //$('.product-thumbnails-slider li:eq(0) img').attr('src', variation_image); } else{ $('a#main-zoom-image').attr('href', variation_link); //$('.product-thumbnails-slider li:eq(0) img').attr('src', variation_image); } }) // Reset product image .on( 'reset_image', function( event ) { var $product = $(this).closest( '.product' ); var $product_img = $product.find( 'a#main-zoom-image img:eq(0)' ); var $product_link = $product.find( 'a#main-zoom-image' ); var o_src = $product_img.attr('data-o_src'); var o_href = $product_link.attr('data-o_href'); $('.woocommerce-main-image').attr('href', o_href); if ($('.main-image-slider').hasClass('zoom-enabled')) { if($(window).width() > 768 && o_src.length > 5 && o_href.length > 5){ $('a#main-zoom-image').swinxyzoom('load', o_src, o_href); } $('a#main-zoom-image').attr('href', o_href); //$('.product-thumbnails-slider li:eq(0) img').attr('src', o_src); } else{ $('a#main-zoom-image').attr('href', o_href); //$('.product-thumbnails-slider li:eq(0) img').attr('src', o_src); } } ); // **********************************************************************// // ! Categories Accordion // **********************************************************************// var plusIcon = '+'; var minusIcon = '–'; if(catsAccordion) { var etCats = $('.product-categories'); var openerHTML = '
'+plusIcon+'
'; etCats.find('>li').has('.children').has('li').addClass('parent-level0').prepend(openerHTML); if($('.current-cat.parent-level0, .current-cat-parent').length > 0) { $('.current-cat.parent-level0, .current-cat-parent').find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show(); } else { etCats.find('>li').first().find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show(); } etCats.find('.open-this').click(function() { if($(this).parent().hasClass('opened')) { $(this).html(plusIcon).parent().removeClass('opened').find('ul.children').slideUp(200); }else { $(this).html(minusIcon).parent().addClass('opened').find('ul.children').slideDown(200); } }); } // **********************************************************************// // ! Toggle elements // **********************************************************************// var etoggle = $('.toggle-block'); var etoggleEl = etoggle.find('.toggle-element'); //etoggleEl.first().addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').show(); etoggleEl.find('.toggle-title').click(function(e) { e.preventDefault(); if($(this).hasClass('opened')) { $(this).removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200); }else { if($(this).parent().hasClass('noMultiple')){ $(this).parent().find('.toggle-element').removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200); } $(this).addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').slideDown(200); } }); // **********************************************************************// // ! Mobile navigation // **********************************************************************// var navList = $('.mobile-nav div > ul'); var etOpener = '(open)'; navList.addClass('et-mobile-menu'); navList.find('li:has(ul)',this).each(function() { $(this).prepend(etOpener); }) navList.find('.open-child').click(function(){ if ($(this).parent().hasClass('over')) { $(this).parent().removeClass('over').find('>ul').slideUp(200); }else{ $(this).parent().parent().find('>li.over').removeClass('over').find('>ul').slideUp(200); $(this).parent().addClass('over').find('>ul').slideDown(200); } }); $('.menu-icon, .close-mobile-nav').click(function(event) { if(!$('body').hasClass('mobile-nav-shown')) { $('body').addClass('mobile-nav-shown', function() { // Hide search input on click setTimeout(function(){ $(document).one("click",function(e) { var target = e.target; if (!$(target).is('.mobile-nav') && !$(target).parents().is('.mobile-nav')) { $('body').removeClass('mobile-nav-shown'); } }); }, 111); }); } else{ $('body').removeClass('mobile-nav-shown'); } }); // **********************************************************************// // ! Side Block // **********************************************************************// $('.side-area-icon, .close-side-area').click(function(event) { if(!$('body').hasClass('shown-side-area')) { $('body').addClass('shown-side-area', function() { // Hide search input on click setTimeout(function(){ $(document).one("click",function(e) { var target = e.target; if (!$(target).is('.side-area') && !$(target).parents().is('.side-area')) { $('body').removeClass('shown-side-area'); } }); }, 111); }); } else{ $('body').removeClass('shown-side-area'); } }); // **********************************************************************// // ! Alerts // **********************************************************************// function closeParentBtn(){ var closeParentBtn = jQuery('.close-parent'); closeParentBtn.click(function(e){ closeParent(this); }); function closeParent(el) { jQuery(el).parent().slideUp(100); } } closeParentBtn(); // **********************************************************************// // ! Contact Form ajax // **********************************************************************// var eForm = $('#contact-form'); var spinner = jQuery('.spinner'); $('.required-field').focus(function(){ $(this).removeClass('validation-failed'); }); eForm.find('#submit').click(function(e){ e.preventDefault(); $('#contactsMsgs').html(''); spinner.show(); var errmsg; errmsg = ''; eForm.find('.required-field').each(function(){ if($(this).val() == '') { $(this).addClass('validation-failed'); } }); if(errmsg){ $('#contactsMsgs').html('

' + errmsg + '

'); spinner.hide(); }else{ url = eForm.attr('action'); data = eForm.serialize(); $.ajax({ url: url, method: 'GET', data: data, error: function(data) { $('#contactsMsgs').html('

Error while ajax request

'); spinner.hide(); }, success : function(data){ if (data.status == 'success') { $('#contactsMsgs').html('

' + data.msg + '

'); eForm.find("input[type=text], textarea").val(""); }else{ $('#contactsMsgs').html('

' + data.msg + '

'); } spinner.hide(); closeParentBtn(); } }); } }); // **********************************************************************// // ! Custom Comment Form Validation // **********************************************************************// var ethemeCommentForm = $('#commentform'); ethemeCommentForm.find('#submit').click(function(e){ $('#commentsMsgs').html(''); ethemeCommentForm.find('.required-field').each(function(){ if($(this).val() == '') { $(this).addClass('validation-failed'); e.preventDefault(); } }); }); // **********************************************************************// // ! Load in view // **********************************************************************// var counters = $('.animated-counter'); counters.each(function(){ $(this).waypoint(function(){ animateCounter($(this)); }, { offset: '100%' }); }); var progressBars = $('.progress-bars'); progressBars.waypoint(function() { i = 0; $(this).find('.progress-bar').each(function () { i++; var el = $(this); var width = $(this).data('width'); setTimeout(function(){ el.find('div').animate({ 'width' : width + '%' },400); el.find('span').css({ 'opacity' : 1 }); },i*300, "easeOutCirc"); }); }, { offset: '85%' }); // helper hex to rgb function componentToHex(c) { var hex = c.toString(16); return hex.length == 1 ? "0" + hex : hex; } function rgbToHex(r, g, b) { return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); } function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } $('.parallax .banner-bg').each(function(){ $(this).parallax('50%',0.05); }); if($(window).width() > 767) { $('.parallax-section').each(function(){ var speed = 0.1; if($(this).data('parallax-speed') != '') { speed = $(this).data('parallax-speed'); } $(this).parallax('50%', speed); }); } }); // document ready /* Plugin: jQuery Parallax Version 1.1.3 Author: Ian Lunn Twitter: @IanLunn Author URL: http://www.ianlunn.co.uk/ Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl.html */ (function( $ ){ var $window = $(window); var windowHeight = $window.height(); $window.resize(function () { windowHeight = $window.height(); }); $.fn.parallax = function(xpos, speedFactor, outerHeight) { var $this = $(this); var getHeight; var firstTop; var paddingTop = 0; //get the starting position of each element to have parallax applied to it $this.each(function(){ firstTop = $this.offset().top; }); if (outerHeight) { getHeight = function(jqo) { return jqo.outerHeight(true); }; } else { getHeight = function(jqo) { return jqo.height(); }; } // setup defaults if arguments aren't specified if (arguments.length < 1 || xpos === null) xpos = "50%"; if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; if (arguments.length < 3 || outerHeight === null) outerHeight = true; // function to be called whenever the window is scrolled or resized function update(){ var pos = $window.scrollTop(); $this.each(function(){ var $element = $(this); var top = $element.offset().top; var height = getHeight($element); var viewportBottom = pos + windowHeight; // Check if totally above or totally below viewport if (top + height < pos || top > viewportBottom) { return; } $this.css('backgroundPosition', xpos + " " + Math.round((top - viewportBottom) * speedFactor) + "px"); }); } $window.bind('scroll', update).resize(update); update(); }; })(jQuery); /* FILE ARCHIVED ON 13:55:59 Mar 08, 2018 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 09:46:17 Jan 06, 2020. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): RedisCDXSource: 4.653 CDXLines.iter: 31.559 (3) exclusion.robots: 0.377 captures_list: 132.237 exclusion.robots.policy: 0.355 esindex: 0.022 PetaboxLoader3.datanode: 105.074 (4) load_resource: 100.963 LoadShardBlock: 86.704 (3) PetaboxLoader3.resolve: 69.36 *e jQuery plugin for magical layouts * http://isotope.metafizzy.co * * Commercial use requires one-time purchase of a commercial license * http://isotope.metafizzy.co/docs/license.html * * Non-commercial use is licensed under the MIT License * * Copyright 2013 Metafizzy */ (function(a,b,c){"use strict";var d=a.document,e=a.Modernizr,f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},g="Moz Webkit O Ms".split(" "),h=function(a){var b=d.documentElement.style,c;if(typeof b[a]=="string")return a;a=f(a);for(var e=0,h=g.length;e"+d+"{#modernizr{height:3px}}"+"").appendTo("head"),f=b('
').appendTo("html");a=f.height()===3,f.remove(),e.remove()}return a},csstransitions:function(){return!!j}},l;if(e)for(l in k)e.hasOwnProperty(l)||e.addTest(l,k[l]);else{e=a.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var m=" ",n;for(l in k)n=k[l](),e[l]=n,m+=" "+(n?"":"no-")+l;b("html").addClass(m)}if(e.csstransforms){var o=e.csstransforms3d?{translate:function(a){return"translate3d("+a[0]+"px, "+a[1]+"px, 0) "},scale:function(a){return"scale3d("+a+", "+a+", 1) "}}:{translate:function(a){return"translate("+a[0]+"px, "+a[1]+"px) "},scale:function(a){return"scale("+a+") "}},p=function(a,c,d){var e=b.data(a,"isoTransform")||{},f={},g,h={},j;f[c]=d,b.extend(e,f);for(g in e)j=e[g],h[g]=o[g](j);var k=h.translate||"",l=h.scale||"",m=k+l;b.data(a,"isoTransform",e),a.style[i]=m};b.cssNumber.scale=!0,b.cssHooks.scale={set:function(a,b){p(a,"scale",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.scale?d.scale:1}},b.fx.step.scale=function(a){b.cssHooks.scale.set(a.elem,a.now+a.unit)},b.cssNumber.translate=!0,b.cssHooks.translate={set:function(a,b){p(a,"translate",b)},get:function(a,c){var d=b.data(a,"isoTransform");return d&&d.translate?d.translate:[0,0]}}}var q,r;e.csstransitions&&(q={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[j],r=h("transitionDuration"));var s=b.event,t=b.event.handle?"handle":"dispatch",u;s.special.smartresize={setup:function(){b(this).bind("resize",s.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",s.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",u&&clearTimeout(u),u=setTimeout(function(){s[t].apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Isotope=function(a,c,d){this.element=b(c),this._create(a),this._init(d)};var v=["width","height"],w=b(a);b.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},b.Isotope.prototype={_create:function(a){this.options=b.extend({},b.Isotope.settings,a),this.styleQueue=[],this.elemCount=0;var c=this.element[0].style;this.originalStyle={};var d=v.slice(0);for(var e in this.options.containerStyle)d.push(e);for(var f=0,g=d.length;fg?1:f0&&(i=function(a,b){b.$el[d](b.style,f).one(q,k)},j=!1)}}b.each(this.styleQueue,i),j&&k(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(a){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,a)},addItems:function(a,b){var c=this._getAtoms(a);this.$allAtoms=this.$allAtoms.add(c),b&&b(c)},insert:function(a,b){this.element.append(a);var c=this;this.addItems(a,function(a){var d=c._filter(a);c._addHideAppended(d),c._sort(),c.reLayout(),c._revealAppended(d,b)})},appended:function(a,b){var c=this;this.addItems(a,function(a){c._addHideAppended(a),c.layout(a),c._revealAppended(a,b)})},_addHideAppended:function(a){this.$filteredAtoms=this.$filteredAtoms.add(a),a.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:a,style:this.options.hiddenStyle})},_revealAppended:function(a,b){var c=this;setTimeout(function(){a.removeClass("no-transition"),c.styleQueue.push({$el:a,style:c.options.visibleStyle}),c._isInserting=!1,c._processStyleQueue(a,b)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(a,b){this.$allAtoms=this.$allAtoms.not(a),this.$filteredAtoms=this.$filteredAtoms.not(a);var c=this,d=function(){a.remove(),b&&b.call(c.element)};a.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:a,style:this.options.hiddenStyle}),this._sort(),this.reLayout(d)):d()},shuffle:function(a){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(a)},destroy:function(){var a=this.usingTransforms,b=this.options;this.$allAtoms.removeClass(b.hiddenClass+" "+b.itemClass).each(function(){var b=this.style;b.position="",b.top="",b.left="",b.opacity="",a&&(b[i]="")});var c=this.element[0].style;for(var d in this.originalStyle)c[d]=this.originalStyle[d];this.element.unbind(".isotope").undelegate("."+b.hiddenClass,"click").removeClass(b.containerClass).removeData("isotope"),w.unbind(".isotope")},_getSegments:function(a){var b=this.options.layoutMode,c=a?"rowHeight":"columnWidth",d=a?"height":"width",e=a?"rows":"cols",g=this.element[d](),h,i=this.options[b]&&this.options[b][c]||this.$filteredAtoms["outer"+f(d)](!0)||g;h=Math.floor(g/i),h=Math.max(h,1),this[b][e]=h,this[b][c]=i},_checkIfSegmentsChanged:function(a){var b=this.options.layoutMode,c=a?"rows":"cols",d=this[b][c];return this._getSegments(a),this[b][c]!==d},_masonryReset:function(){this.masonry={},this._getSegments();var a=this.masonry.cols;this.masonry.colYs=[];while(a--)this.masonry.colYs.push(0)},_masonryLayout:function(a){var c=this,d=c.masonry;a.each(function(){var a=b(this),e=Math.ceil(a.outerWidth(!0)/d.columnWidth);e=Math.min(e,d.cols);if(e===1)c._masonryPlaceBrick(a,d.colYs);else{var f=d.cols+1-e,g=[],h,i;for(i=0;id&&(e.x=0,e.y=e.height),c._pushPosition(a,e.x,e.y),e.height=Math.max(e.y+g,e.height),e.x+=f})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(a){var c=this,d=this.cellsByRow;a.each(function(){var a=b(this),e=d.index%d.cols,f=Math.floor(d.index/d.cols),g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,0,c.straightDown.y),c.straightDown.y+=d.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var a=this.masonryHorizontal.rows;this.masonryHorizontal.rowXs=[];while(a--)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(a){var c=this,d=c.masonryHorizontal;a.each(function(){var a=b(this),e=Math.ceil(a.outerHeight(!0)/d.rowHeight);e=Math.min(e,d.rows);if(e===1)c._masonryHorizontalPlaceBrick(a,d.rowXs);else{var f=d.rows+1-e,g=[],h,i;for(i=0;id&&(e.x=e.width,e.y=0),c._pushPosition(a,e.x,e.y),e.width=Math.max(e.x+f,e.width),e.y+=g})},_fitColumnsGetContainerSize:function(){return{width:this.fitColumns.width}},_fitColumnsResizeChanged:function(){return!0},_cellsByColumnReset:function(){this.cellsByColumn={index:0},this._getSegments(),this._getSegments(!0)},_cellsByColumnLayout:function(a){var c=this,d=this.cellsByColumn;a.each(function(){var a=b(this),e=Math.floor(d.index/d.rows),f=d.index%d.rows,g=(e+.5)*d.columnWidth-a.outerWidth(!0)/2,h=(f+.5)*d.rowHeight-a.outerHeight(!0)/2;c._pushPosition(a,g,h),d.index++})},_cellsByColumnGetContainerSize:function(){return{width:Math.ceil(this.$filteredAtoms.length/this.cellsByColumn.rows)*this.cellsByColumn.columnWidth}},_cellsByColumnResizeChanged:function(){return this._checkIfSegmentsChanged(!0)},_straightAcrossReset:function(){this.straightAcross={x:0}},_straightAcrossLayout:function(a){var c=this;a.each(function(a){var d=b(this);c._pushPosition(d,c.straightAcross.x,0),c.straightAcross.x+=d.outerWidth(!0)})},_straightAcrossGetContainerSize:function(){return{width:this.straightAcross.x}},_straightAcrossResizeChanged:function(){return!0}},b.fn.imagesLoaded=function(a){function h(){a.call(c,d)}function i(a){var c=a.target;c.src!==f&&b.inArray(c,g)===-1&&(g.push(c),--e<=0&&(setTimeout(h),d.unbind(".imagesLoaded",i)))}var c=this,d=c.find("img").add(c.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",g=[];return e||h(),d.bind("load.imagesLoaded error.imagesLoaded",i).each(function(){var a=this.src;this.src=f,this.src=a}),c};var x=function(b){a.console&&a.console.error(b)};b.fn.isotope=function(a,c){if(typeof a=="string"){var d=Array.prototype.slice.call(arguments,1);this.each(function(){var c=b.data(this,"isotope");if(!c){x("cannot call methods on isotope prior to initialization; attempted to call method '"+a+"'");return}if(!b.isFunction(c[a])||a.charAt(0)==="_"){x("no such method '"+a+"' for isotope instance");return}c[a].apply(c,d)})}else this.each(function(){var d=b.data(this,"isotope");d?(d.option(a),d._init(c)):b.data(this,"isotope",new b.Isotope(a,this,c))});return this}})(window,jQuery); jQuery(document).ready(function($){ // **********************************************************************// // ! 8theme Mega Search // **********************************************************************// $.fn.etMegaSearch = function ( options ) { var et_search = $(this); var form = et_search.find('form'); var input = form.find('input[type="text"]'); var resultArea = et_search.find('.et-search-result'); var close = et_search.find('.et-close-results'); input.keyup(function() { if($(this).val() == '' || $(this).val().length < 3) { et_search.removeClass('loading result-exist'); return; } data = 's='+$(this).val() + '&products=' + et_search.data('products') + '&count=' + et_search.data('count') + '&images=' + et_search.data('images') + '&posts=' + et_search.data('posts') + '&portfolio=' + et_search.data('portfolio') + '&pages=' + et_search.data('pages') + '&action=et_get_search_result'; et_search.addClass('loading'); resultArea.html(''); $.ajax({ url: myAjax.ajaxurl, method: 'GET', data: data, dataType: 'JSON', error: function(data) { console.log('AJAX error'); }, success : function(data){ if(data.results) { et_search.addClass('result-exist'); } else { et_search.removeClass('result-exist'); } resultArea.html(data.html); }, complete : function() { et_search.removeClass('loading'); } }); }); close.click(function() { et_search.removeClass('result-exist'); }); return this; } $('.et-mega-search').each(function(){ $(this).etMegaSearch(); }); // **********************************************************************// // ! Media Elements with JS // **********************************************************************// jQuery('video:not(.et-section-video)').mediaelementplayer({ success: function(player, node) { jQuery('#' + node.id + '-mode').html('mode: ' + player.pluginType); } }); // **********************************************************************// // ! Countdown // **********************************************************************// $.fn.countdown = function ( options ) { var settings = $.extend({ type: "default" }, options ); setInterval(function countdown_update() { var countdown = $('.et-timer'); var eventDate = Date.parse(countdown.data('final')) / 1000; var currentDate = Math.floor($.now() / 1000); var days = countdown.find('.days'); var hours = countdown.find('.hours'); var minutes = countdown.find('.minutes'); var seconds = countdown.find('.seconds'); var remindSeconds = eventDate-currentDate; if(remindSeconds > 0) { var remindDays = Math.floor(remindSeconds / (60 * 60 * 24)); remindSeconds -= remindDays * 60 * 60 * 24; var remindHours = Math.floor(remindSeconds / (60 * 60)); remindSeconds -= remindHours * 60 * 60; var remindMinutes = Math.floor(remindSeconds / (60)); remindSeconds -= remindMinutes * 60; if(remindDays < 10) remindDays = '0' + remindDays; if(remindHours < 10) remindHours = '0' + remindHours; if(remindMinutes < 10) remindMinutes = '0' + remindMinutes; if(remindSeconds < 10) remindSeconds = '0' + remindSeconds; if(days < 1 || remindDays == '00') { days.parent().hide().next().hide(); } else { days.text(remindDays); } hours.text(remindHours); minutes.text(remindMinutes); seconds.text(remindSeconds); } }, 1000); return this; } $('.et-timer').countdown(); // **********************************************************************// // ! Promo popup // **********************************************************************// var et_popup_closed = $.cookie('etheme_popup_closed'); $('.etheme-popup').magnificPopup({ type: 'inline', preloader: false, focus: '#username', modal: true }); if(et_popup_closed != 'do-not-show') { $('.etheme-popup').click(); } $(document).on('click', '.popup-modal-dismiss', function (e) { e.preventDefault(); $.magnificPopup.close(); if($('#showagain:checked').val() == 'do-not-show') $.cookie('etheme_popup_closed', 'do-not-show', { expires: 1, path: '/' } ); }); // **********************************************************************// // ! Images lightbox // **********************************************************************// $("a[rel^='lightboxGall']").magnificPopup({ type:'image', gallery:{ enabled:true } }); $("a[rel='lightbox']").magnificPopup({ type:'image' }); // **********************************************************************// // ! Mobile loader // **********************************************************************// $('.mobile-loader > div').fadeOut(300); $('.mobile-loader').delay(300).fadeOut(800, function(){ $('.mobile-loader').remove(); }); // **********************************************************************// // ! Product images sections loading // **********************************************************************// $('.single-product-page .images').addClass('shown'); // **********************************************************************// // ! Animated Counters // **********************************************************************// function animateCounter(el) { var initVal = parseInt(el.text()); var finalVal = el.data('value'); if(finalVal <= initVal) return; var intervalTime = 1; var time = 200; var step = parseInt((finalVal - initVal)/time.toFixed()); if(step < 1) { step = 1; time = finalVal - initVal; } var firstAdd = (finalVal - initVal)/step - time; var counter = parseInt((firstAdd*step).toFixed()) + initVal; var i = 0; var interval = setInterval(function(){ i++; counter = counter + step; el.text(counter); if(i == time) { clearInterval(interval); } }, intervalTime); } // **********************************************************************// // ! Full width section // **********************************************************************// function et_sections(){ $('.et_section').each(function(){ $(this).css({ 'left': - ($(window).width() - $('.header > .container').width())/2, 'width': $(window).width(), 'visibility': 'visible' }); var videoTag = $(this).find('.section-back-video video'); videoTag.css({ 'width': $(window).width(), //'height': $(window).width() * videoTag.height() / videoTag.width() }); }); } et_sections() $(window).resize(function(){ et_sections(); }) // **********************************************************************// // ! Hidden Top Panel // **********************************************************************// $(function(){ var topPanel = $('.top-panel'); var pageWrapper = $('.page-wrapper'); var showPanel = $('.show-top-panel'); var panelHeight = topPanel.outerHeight(); showPanel.toggle(function(){ $(this).addClass('show-panel'); pageWrapper.attr('style','transform: translateY('+panelHeight+'px);-ms-transform: translateY('+panelHeight+'px);-webkit-transform: translateY('+panelHeight+'px);'); topPanel.addClass('show-panel'); },function(){ pageWrapper.attr('style','') topPanel.removeClass('show-panel'); $(this).removeClass('show-panel'); }); }); // **********************************************************************// // ! Remove some br and p // **********************************************************************// $('.toggle-element ~ br').remove(); $('.toggle-element ~ p').remove(); $('.block-with-ico h5').next('p').remove(); $('.tab-content .row-fluid').next('p').remove(); $('.tab-content .row-fluid').prev('p').remove(); // **********************************************************************// // ! Update Favicon // **********************************************************************// function et_update_favicon() { var itemsCount = $('.cart-summ').data('items-count'); var enableBadge = $('.shopping-cart-widget').data('fav-badge'); var favicon = new Favico({ animation : 'popFade', fontStyle : 'normal', }); if (enableBadge == 'enable') { favicon.badge(itemsCount); } } et_update_favicon(); // **********************************************************************// // ! Fade animations // **********************************************************************// setTimeout(function() { $('.fade-in').removeClass('fade-in'); }, 500); // **********************************************************************// // ! Products grid images slider // **********************************************************************// function contentProdImages() { $('.hover-effect-slider').each(function() { var slider = $(this); var index = 0; var autoSlide; var imageLink = slider.find('.product-content-image'); var imagesList = imageLink.data('images-list'); imagesList = imagesList.split(","); var arrowsHTML = '
left
right
'; var counterHTML = '
1/' + imagesList.length + '
'; if(imagesList.length > 1) { slider.prepend(arrowsHTML); slider.prepend(counterHTML); // Previous image on click on left arrow slider.find('.arrow-left').click(function(event) { if(index > 0) { index--; } else { index = imagesList.length-1; // if the first item set it to last } imageLink.find('img').attr('src', imagesList[index]); // change image src slider.find('.current-index').text(index + 1); // update slider counter }); // Next image on click on left arrow slider.find('.arrow-right').click(function(event) { if(index < imagesList.length - 1) { index++; } else { index = 0; // if the last image set it to first } imageLink.find('img').attr('src', imagesList[index]);// change image src slider.find('.current-index').text(index + 1);// update slider counter }); } }); } contentProdImages(); // **********************************************************************// // ! Wishlist // **********************************************************************// $('.yith-wcwl-add-button.show').each(function(){ var wishListText = $(this).find('a').text(); $(this).find('a').attr('data-hover',wishListText); }); // **********************************************************************// // ! Main Navigation plugin // **********************************************************************// $.fn.et_menu = function ( options ) { var methods = { showChildren: function(el) { el.fadeIn(100).css({ display: 'list-item', listStyle: 'none' }).find('li').css({listStyle: 'none'}); }, calculateColumns: function(el) { // calculate columns count var columnsCount = el.find('.container > ul > li.menu-item-has-children').length; var dropdownWidth = el.find('.container > ul > li').outerWidth(); var padding = 20; if(columnsCount > 1) { dropdownWidth = dropdownWidth*columnsCount + padding; el.css({ 'width':dropdownWidth }); } // calculate right offset of the dropdown var headerWidth = $('.menu-wrapper').outerWidth(); var headerLeft = $('.menu-wrapper').offset().left; var dropdownOffset = el.offset().left - headerLeft; var dropdownRight = headerWidth - (dropdownOffset + dropdownWidth); if(dropdownRight < 0) { el.css({ 'left':'auto', 'right':0 }); } }, openOnClick: function(el,e) { var timeOutTime = 0; var openedClass = "current"; var header = $('.header-wrapper'); var $this = el; if($this.parent().hasClass(openedClass)) { e.preventDefault(); $this.parent().removeClass(openedClass); $this.next().stop().slideUp(settings.animTime); header.stop().animate({'paddingBottom': 0}, settings.animTime); } else { if($this.parent().find('>div').length < 1) { return; } e.preventDefault(); if($this.parent().parent().find('.' + openedClass).length > 0) { timeOutTime = settings.animTime; header.stop().animate({'paddingBottom': 0}, settings.animTime); } $this.parent().parent().find('.' + openedClass).removeClass(openedClass).find('>div').stop().slideUp(settings.animTime); setTimeout(function(){ $this.parent().addClass(openedClass); header.stop().animate({'paddingBottom': $this.next().height()+50},settings.animTime); $this.next().stop().slideDown(settings.animTime); },timeOutTime); } } }; var settings = $.extend({ type: "default", // can be columns, default, mega, combined animTime: 250, openByClick: true }, options ); if(settings.type == 'mega') { this.find('>li>a').click(function(e) { methods.openOnClick($(this),e); }); return this; } this.find('>li').hover(function (){ if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { if(settings.openByClick) { $('.open-by-click.current').find('>a').click(); $(this).find('>a').unbind('click'); } var dropdown = $(this).find('> .nav-sublist-dropdown'); methods.showChildren(dropdown); if(settings.type == 'columns') { methods.calculateColumns(dropdown); } } else { $(this).find('>a').unbind('click'); $(this).find('>a').bind('click', function(e) { methods.openOnClick($(this),e); }); } }, function () { if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { $(this).find('> .nav-sublist-dropdown').fadeOut(100).attr('style', ''); } }); return this; } // First Type of column Menu $('.main-nav .menu').et_menu({ type: "default" }); $('.fixed-header .menu').et_menu({ openByClick: false }); function et_equalize_height(elements, removeHeight) { var heights = []; if(removeHeight) { elements.attr('style', ''); } elements.each(function(){ heights.push($(this).height()); }); var maxHeight = Math.max.apply( Math, heights ); if($(window).width() > 767) { elements.height(maxHeight); } } $(window).resize(function(){ //et_equalize_height($('.product-category'), true); }); // **********************************************************************// // ! "Top" button // **********************************************************************// var scroll_timer; var displayed = false; var $message = jQuery('.back-to-top'); jQuery(window).scroll(function () { window.clearTimeout(scroll_timer); scroll_timer = window.setTimeout(function () { if(jQuery(window).scrollTop() <= 0) { displayed = false; $message.removeClass('btt-shown'); } else if(displayed == false) { displayed = true; $message.stop(true, true).addClass('btt-shown').click(function () { $message.removeClass('btt-shown'); }); } }, 400); }); jQuery('.back-to-top').click(function(e) { jQuery('html, body').animate({scrollTop:0}, 600); return false; }); // **********************************************************************// // ! Portfolio // **********************************************************************// $portfolio = $('.masonry'); $portfolio.each(function() { var portfolioGrid = $(this); portfolioGrid.isotope({ itemSelector: '.portfolio-item' }); $(window).smartresize(function(){ portfolioGrid.isotope({ itemSelector: '.portfolio-item' }); }); portfolioGrid.parent().find('.portfolio-filters a').click(function(){ var selector = $(this).attr('data-filter'); portfolioGrid.parent().find('.portfolio-filters a').removeClass('active'); if(!$(this).hasClass('active')) { $(this).addClass('active'); } portfolioGrid.isotope({ filter: selector }); return false; }); }); setTimeout(function(){ $('.portfolio').addClass('with-transition'); $('.portfolio-item').addClass('with-transition'); $(window).resize(); },500); // **********************************************************************// // ! Blog isotope // **********************************************************************// $blog = $('.blog-masonry'); $blog.isotope({ itemSelector: '.post-grid' }); $('.copyright .logo-small').click(function(){ var $newItems = $(''); $blog.isotope( 'insert', $newItems ); }); $(window).smartresize(function(){ $blog.isotope({ itemSelector: '.post-grid' }); }); $('body').on('click', '.load-more-posts a', function(e){ e.preventDefault(); var url = $(this).attr('href'); if($(this).length>0) { et_add_blog_posts(url); $loading = true; } }); var $loading = false; $(window).scroll(function(){ var $window = $(window); var $element = $('.load-more-posts'); if($element.length>0) { var pos = $window.scrollTop(); windowHeight = $window.height(); var top = $element.offset().top; var height = $element.height(); var viewportBottom = pos + windowHeight; // Check if totally above or totally below viewport if (top + height < pos || top > viewportBottom) { return; } var url = $element.find('a').attr('href'); if($element.find('a').length>0) { et_add_blog_posts(url); $loading = true; } } }); function et_add_blog_posts(url){ if($loading) return; $.ajax({ url: url, method: 'GET', timeout: 10000, dataType: 'text', beforeSend: function() { $('.load-more-posts').addClass('loading'); }, success: function(data) { $('.blog-masonry').addClass('with-transition'); $('.post-grid').addClass('with-transition'); $('.blog-masonry').isotope( 'insert', $(data).find('.blog-masonry .post-grid') ); $('.load-more-posts').html($(data).find('.load-more-posts').html()); }, error: function(data) { console.log('Error loading ajax content!'); window.location.reload(); }, complete: function() { setTimeout(function(){ $(window).resize(); },100); setTimeout(function(){ $loading = false; },500); $('.load-more-posts').removeClass('loading'); } }); return; } // **********************************************************************// // ! Other elements isotope // **********************************************************************// $container = $('.isotope-container'); $isotope = $('.et_isotope'); $isotope.each(function() { var isotope = $(this); isotope.isotope({ itemSelector: '.et_isotope-item' }); $(window).smartresize(function(){ isotope.isotope({ itemSelector: '.et_isotope-item' }); }); setTimeout(function(){ isotope.addClass('with-transition'); isotope.find('.et_isotope-item').addClass('with-transition'); $(window).resize(); },500); }); $container.each(function() { var container = $(this); var isotope = container.find('.et_isotope'); container.find('.et_categories_filter a').data('isotope', isotope).click(function(e){ e.preventDefault(); var isotope = jQuery(this).data('isotope'); jQuery(this).parent().parent().find('.active').removeClass('active'); jQuery(this).addClass('active'); isotope.isotope({filter: jQuery(this).attr('data-filter')}); }); }); // **********************************************************************// // ! Fixed header // **********************************************************************// $(window).scroll(function(){ if (!$('body').hasClass('fixNav-enabled')) {return false; } var fixedHeader = $('.fixed-header-area'); var scrollTop = $(this).scrollTop(); var headerHeight = $('.header-wrapper').height() + 20; if(scrollTop > headerHeight){ if(!fixedHeader.hasClass('fixed-already')) { fixedHeader.stop().addClass('fixed-already'); } }else{ if(fixedHeader.hasClass('fixed-already')) { fixedHeader.stop().removeClass('fixed-already'); } } }); // **********************************************************************// // ! Icons Preview // **********************************************************************// var modalDiv = $('#iconModal'); $('.demo-icons .demo-icon').click(function(){ var name = $(this).find('i').attr('class'); modalDiv.find('i').each(function(){ $(this).attr('class',name); }); modalDiv.find('#myModalLabel').text(name); modalDiv.modal(); }); // **********************************************************************// // ! Testimonials Gallery // **********************************************************************// $('.testimonials-slider').cbpQTRotator(); // **********************************************************************// // ! WooCommerce // **********************************************************************// // **********************************************************************// // ! Remove from cart with AJAX // **********************************************************************// $(document.body).on('click', '.cart-popup .delete-btn, .shopping-cart .product-remove a', function(e){ e.preventDefault(); var $this = $(this); var key = $this.data('key'); $.ajax({ method: "POST", url: woocommerce_params.ajax_url, data: { 'action': 'et_remove_from_cart', 'key' : key }, error: function() { console.log('removing from cart AJAX error'); }, success: function(response) { $('#cartModal').replaceWith(response.fragments.cart_modal); $('.shopping-cart-widget').replaceWith(response.fragments.top_cart); et_update_favicon(); $this.parent().parent().remove(); $('.success').remove(); $('table.cart').before('

' + response.msg + 'close

'); } }); }); // **********************************************************************// // ! Products view switcher // **********************************************************************// function listSwitcher() { var activeClass = 'switcher-active'; var gridClass = 'products-grid'; var listClass = 'products-list'; jQuery('.switchToList').click(function(){ if(!jQuery.cookie('products_page') || jQuery.cookie('products_page') == 'grid'){ switchToList(); } }); jQuery('.switchToGrid').click(function(){ if(!jQuery.cookie('products_page') || jQuery.cookie('products_page') == 'list'){ switchToGrid(); } }); function switchToList(){ jQuery('.switchToList').addClass(activeClass); jQuery('.switchToGrid').removeClass(activeClass); jQuery('.product-loop').fadeOut(300,function(){ jQuery(this).removeClass(gridClass).addClass(listClass).fadeIn(300); jQuery.cookie('products_page', 'list', { expires: 3, path: '/' }); }); } function switchToGrid(){ jQuery('.switchToGrid').addClass(activeClass); jQuery('.switchToList').removeClass(activeClass); jQuery('.product-loop').fadeOut(300,function(){ jQuery(this).removeClass(listClass).addClass(gridClass).fadeIn(300); jQuery.cookie('products_page', 'grid', { expires: 3, path: '/' }); }); } } function check_view_mod(){ var activeClass = 'switcher-active'; if(jQuery.cookie('products_page') == 'grid') { jQuery('.product-loop').removeClass('products-list').addClass('products-grid'); jQuery('.switchToGrid').addClass(activeClass); }else if(jQuery.cookie('products_page') == 'list') { jQuery('.product-loop').removeClass('products-grid').addClass('products-list'); jQuery('.switchToList').addClass(activeClass); }else{ if(view_mode_default == 'list_grid' || view_mode_default == 'list') { jQuery('.switchToList').addClass(activeClass); }else{ jQuery('.switchToGrid').addClass(activeClass); } } } listSwitcher(); check_view_mod(); // **********************************************************************// // ! Checkout login form // **********************************************************************// $('a.showlogin').click(function(){ $('form.et_login').slideToggle(); return false; }); // **********************************************************************// // ! Step by step checkout // **********************************************************************// var stepsNav = $('.checkout-steps-nav'); var steps = $('.checkout-steps'); var nextStepBtn = $('.continue-checkout'); stepsNav.find('li a').click(function(e) { e.preventDefault(); var link = $(this); var stepId = link.data('step'); showStep(stepId); }); nextStepBtn.click(function(e) { e.preventDefault(); var nextId = $(this).data('next'); showStep(nextId); }); steps.find('.active').show(); // checkout method var radioBtns = $('input[name="method"]'); radioBtns.change(function() { var checkedMethod = jQuery(this).val(); checkMethod(checkedMethod); }); checkMethod($('input[name="method"]:checked').val()); function showStep(id) { var stepsNav = $('.checkout-steps-nav'); $('.checkout-step').fadeOut(200); stepsNav.find('li a').removeClass('active filled'); for(var i = id; i>0; i--) { $('#tostep' + i + ' a').addClass('filled'); } $('#tostep' + id + ' a').addClass('active'); setTimeout(function(){ $('#step' + id).fadeIn(200); }, 200); } function checkMethod(val){ if(val == 2) { $('#tostep2').css('display','inline-block'); $('#createaccount').attr('checked', true); $('#step1 .continue-checkout').data('next',2); }else{ $('#tostep2').hide(); $('#createaccount').attr('checked', false); $('#step1 .continue-checkout').data('next',3); } } /* Ajax Filter */ function ajaxProductLoad(url,blockId) { $.ajax({ url: url, method: 'GET', timeout: 10000, dataType: 'text', success: function(data) { productLoaded(data,blockId); }, error: function(data) { alert('Error loading ajax content!'); window.location.reload(); } }); } function productLoaded(data,blockId) { //hide spinner $('.woocommerce-pagination').html($(data).find('.woocommerce-pagination').html()); for(var i=0; i
'); ajaxProductLoad(url,blockId); event.stopPropagation(); return false; }); } // Ajax add to cart var modalWindow = jQuery('.etheme-simple-product').eModal(); $('.etheme-simple-product').live('click', function(e) { e.preventDefault(); // AJAX add to cart request var $thisbutton = $(this); if ($thisbutton.is('.etheme-simple-product, .product_type_downloadable, .product_type_virtual')) { $('#top-cart').addClass('updating'); formAction = $('form.cart').attr('action'); var data = $('form.cart').serializeArray(); modalWindow.eModal('showModal'); // Trigger event $('body').trigger('adding_to_cart'); // Ajax action $.ajax({ url: formAction, data: data, method: 'POST', timeout: 10000, dataType: 'text', error: function(data) { modalWindow.eModal('endLoading') .eModal('addError', 'Error with ajax') .eModal('addBtn',{ title: contBtn, href: 'javascript:void(0);', cssClass: 'button small hidewindow', hideOnClick: true }); }, success : function(data,statusText,xhr ) { jQuery('.shopping-cart-widget').html(jQuery(data).find('.shopping-cart-widget').html()); jQuery('.cart-totals').html(jQuery(data).find('.cart-totals').html()); jQuery('#shopping-cart-modal').html(jQuery(data).find('#shopping-cart-modal').html()); et_update_favicon(); if($('.thumbnails img').length > 0) { productImageSrc = $('.thumbnails img').first().attr('src'); } else { productImageSrc = $('.main-image-slider img').first().attr('src'); } productName = $('.product_title').first().text(); modalWindow.eModal('endLoading') .eModal('setTitle',productName) .eModal('addImage', productImageSrc) .eModal('addText', successfullyAdded) .eModal('addBtn',{ title: contBtn, href: 'javascript:void(0);', cssClass: 'button small hidewindow', hideOnClick: true }) .eModal('addBtn',{ title: checkBtn, href: checkoutUrl, cssClass: 'button filled active small arrow-right' }); } }); return false; } else { return true; } }); // Ajax add to cart (on list page) $('.etheme_add_to_cart_button').live('click', function() { // AJAX add to cart request var $thisbutton = $(this); if ($thisbutton.is('.product_type_simple, .product_type_downloadable, .product_type_virtual')) { if (!$thisbutton.attr('data-product_id')) return true; $thisbutton.removeClass('added'); $thisbutton.parent().parent().addClass('loading'); $thisbutton.after('
'); var data = { action: 'et_woocommerce_add_to_cart', product_id: $thisbutton.attr('data-product_id'), quantity: 1 }; // Trigger event $('body').trigger( 'adding_to_cart', [ $thisbutton, data ] ); // Ajax action $.post( woocommerce_params.ajax_url, data, function( response ) { if ( ! response ) return; var this_page = window.location.toString(); this_page = this_page.replace( 'add-to-cart', 'added-to-cart' ); if ( response.error && response.product_url ) { window.location = response.product_url; return; } // Redirect to cart option if ( woocommerce_params.cart_redirect_after_add == 'yes' ) { window.location = woocommerce_params.cart_url; return; } else { $thisbutton.parent().find('#floatingCirclesG').remove(); fragments = response.fragments; cart_hash = response.cart_hash; // Changes button classes $thisbutton.addClass('added').parent().prepend('
' + successfullyAdded + '
'); setTimeout(function() { $thisbutton.parent().parent().removeClass('loading'); $thisbutton.removeClass('added'); $('.added-text').fadeOut(300); }, 3000) // Cart widget load et_update_favicon(); $('#cartModal').replaceWith(fragments.cart_modal); $('.shopping-cart-widget').replaceWith(fragments.top_cart); $('.cart-totals').replaceWith(fragments.cart_totals); $('body').trigger('cart_widget_refreshed'); // Trigger event so themes can refresh other areas $('body').trigger( 'added_to_cart', [ fragments, cart_hash ] ); } }); return false; } else { return true; } }); // **********************************************************************// // ! AJAX Quick View // **********************************************************************// $(document.body).on('click', '.show-quickly, .show-quickly-btn', (function() { var $thisbutton = $(this); var prodid = $thisbutton.data('prodid'); var magnificPopup; $.ajax({ url: woocommerce_params.ajax_url, method: 'POST', data: { 'action': 'et_product_quick_view', 'prodid': prodid }, dataType: 'html', beforeSend: function() { $thisbutton.parent().parent().addClass('loading'); $thisbutton.after('
'); }, complete: function() { $thisbutton.parent().find('#floatingCirclesG').remove(); $thisbutton.parent().parent().removeClass('loading'); }, success: function(response){ $.magnificPopup.open({ items: { src: '
' + response + '
' }, type: 'inline', removalDelay: 500, //delay removal by X to allow out-animation callbacks: { beforeOpen: function() { this.st.mainClass = 'mfp-zoom-in-to-left-out'; } } }, 0); $(function() { $('.variations_form').wc_variation_form(); $('.variations_form .variations select').change(); }); $('.images').addClass('shown'); }, error: function() { $.magnificPopup.open({ items: { src: '
Error with AJAX request
' }, type: 'inline', removalDelay: 500, //delay removal by X to allow out-animation callbacks: { beforeOpen: function() { this.st.mainClass = 'mfp-zoom-in-to-left-out'; } } }, 0); } }); })); // **********************************************************************// // ! Search form // **********************************************************************// var searchBlock = $('.search.hide-input'); var searchForm = searchBlock.find('#searchform'); var searchBtn = searchForm.find('.button'); var searchInput = searchForm.find('input[type="text"]'); searchBtn.click(function(e) { e.preventDefault(); searchInput.fadeIn(200).focus(); $('body').addClass('search-input-shown'); // Hide search input on click $(document).click(function(e) { var target = e.target; if (!$(target).is('.search.hide-input') && !$(target).parents().is('.search.hide-input')) { searchInput.fadeOut(200); $('body').removeClass('search-input-shown'); } }); }); // **********************************************************************// // ! Tabs // **********************************************************************// var tabs = $('.tabs'); $('.tabs > p > a').unwrap('p'); var leftTabs = $('.left-bar, .right-bar'); var newTitles; leftTabs.each(function(){ var currTab = $(this); //currTab.find('> a.tab-title').each(function(){ newTitles = currTab.find('> a.tab-title').clone().removeClass('tab-title').addClass('tab-title-left'); //}); newTitles.first().addClass('opened'); var tabNewTitles = $('
').prependTo(currTab); tabNewTitles.html(newTitles); currTab.find('.tab-content').css({ 'minHeight' : tabNewTitles.height() }); }); tabs.each(function(){ var currTab = $(this); currTab.find('.tab-title').first().addClass('opened').next().show(); currTab.find('.tab-title, .tab-title-left').click(function(e){ e.preventDefault(); var tabId = $(this).attr('id'); if($(this).hasClass('opened')){ if(currTab.hasClass('accordion') || $(window).width() < 767){ $(this).removeClass('opened'); $('#content_'+tabId).hide(); } }else{ currTab.find('.tab-title, .tab-title-left').each(function(){ var tabId = $(this).attr('id'); $(this).removeClass('opened'); $('#content_'+tabId).hide(); }); if(currTab.hasClass('accordion') || $(window).width() < 767){ $('#content_'+tabId).removeClass('tab-content').show(); setTimeout(function(){ $('#content_'+tabId).addClass('tab-content').show(); // Fix it },1); } else { $('#content_'+tabId).show(); } $(this).addClass('opened'); } }); }); /* * Variations images changes * to make it work properly comment in woocommerce/assets/js/frontend/add-to-cart-variation.js * this.unbind( 'check_variations update_variation_values found_variation' ); */ $('form.variations_form').on( 'found_variation', function( event, variation ) { var $variation_form = $(this); var $product = $(this).closest( '.product' ); var $product_img = $product.find( 'a#main-zoom-image img:eq(0)' ); var $product_link = $product.find( 'a#main-zoom-image' ); $product_link.attr('data-o_href',$product_link.attr('href')); var o_src = $product_img.attr('data-o_src'); var o_title = $product_img.attr('data-o_title'); var o_href = $product_link.attr('data-o_href'); var variation_image = variation.image_src; var variation_link = variation.image_link; var variation_title = variation.image_title; $('.woocommerce-main-image').attr('href', variation_image); if ($('.main-image-slider').hasClass('zoom-enabled')) { console.log(variation_image); console.log(variation_link); if($(window).width() > 768 && variation_image.length > 5 && variation_link.length > 5){ $('a#main-zoom-image').swinxyzoom('load', variation_image, variation_link); } $('a#main-zoom-image').attr('href', variation_link); //$('.product-thumbnails-slider li:eq(0) img').attr('src', variation_image); } else{ $('a#main-zoom-image').attr('href', variation_link); //$('.product-thumbnails-slider li:eq(0) img').attr('src', variation_image); } }) // Reset product image .on( 'reset_image', function( event ) { var $product = $(this).closest( '.product' ); var $product_img = $product.find( 'a#main-zoom-image img:eq(0)' ); var $product_link = $product.find( 'a#main-zoom-image' ); var o_src = $product_img.attr('data-o_src'); var o_href = $product_link.attr('data-o_href'); $('.woocommerce-main-image').attr('href', o_href); if ($('.main-image-slider').hasClass('zoom-enabled')) { if($(window).width() > 768 && o_src.length > 5 && o_href.length > 5){ $('a#main-zoom-image').swinxyzoom('load', o_src, o_href); } $('a#main-zoom-image').attr('href', o_href); //$('.product-thumbnails-slider li:eq(0) img').attr('src', o_src); } else{ $('a#main-zoom-image').attr('href', o_href); //$('.product-thumbnails-slider li:eq(0) img').attr('src', o_src); } } ); // **********************************************************************// // ! Categories Accordion // **********************************************************************// var plusIcon = '+'; var minusIcon = '–'; if(catsAccordion) { var etCats = $('.product-categories'); var openerHTML = '
'+plusIcon+'
'; etCats.find('>li').has('.children').has('li').addClass('parent-level0').prepend(openerHTML); if($('.current-cat.parent-level0, .current-cat-parent').length > 0) { $('.current-cat.parent-level0, .current-cat-parent').find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show(); } else { etCats.find('>li').first().find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show(); } etCats.find('.open-this').click(function() { if($(this).parent().hasClass('opened')) { $(this).html(plusIcon).parent().removeClass('opened').find('ul.children').slideUp(200); }else { $(this).html(minusIcon).parent().addClass('opened').find('ul.children').slideDown(200); } }); } // **********************************************************************// // ! Toggle elements // **********************************************************************// var etoggle = $('.toggle-block'); var etoggleEl = etoggle.find('.toggle-element'); //etoggleEl.first().addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').show(); etoggleEl.find('.toggle-title').click(function(e) { e.preventDefault(); if($(this).hasClass('opened')) { $(this).removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200); }else { if($(this).parent().hasClass('noMultiple')){ $(this).parent().find('.toggle-element').removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200); } $(this).addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').slideDown(200); } }); // **********************************************************************// // ! Mobile navigation // **********************************************************************// var navList = $('.mobile-nav div > ul'); var etOpener = '(open)'; navList.addClass('et-mobile-menu'); navList.find('li:has(ul)',this).each(function() { $(this).prepend(etOpener); }) navList.find('.open-child').click(function(){ if ($(this).parent().hasClass('over')) { $(this).parent().removeClass('over').find('>ul').slideUp(200); }else{ $(this).parent().parent().find('>li.over').removeClass('over').find('>ul').slideUp(200); $(this).parent().addClass('over').find('>ul').slideDown(200); } }); $('.menu-icon, .close-mobile-nav').click(function(event) { if(!$('body').hasClass('mobile-nav-shown')) { $('body').addClass('mobile-nav-shown', function() { // Hide search input on click setTimeout(function(){ $(document).one("click",function(e) { var target = e.target; if (!$(target).is('.mobile-nav') && !$(target).parents().is('.mobile-nav')) { $('body').removeClass('mobile-nav-shown'); } }); }, 111); }); } else{ $('body').removeClass('mobile-nav-shown'); } }); // **********************************************************************// // ! Side Block // **********************************************************************// $('.side-area-icon, .close-side-area').click(function(event) { if(!$('body').hasClass('shown-side-area')) { $('body').addClass('shown-side-area', function() { // Hide search input on click setTimeout(function(){ $(document).one("click",function(e) { var target = e.target; if (!$(target).is('.side-area') && !$(target).parents().is('.side-area')) { $('body').removeClass('shown-side-area'); } }); }, 111); }); } else{ $('body').removeClass('shown-side-area'); } }); // **********************************************************************// // ! Alerts // **********************************************************************// function closeParentBtn(){ var closeParentBtn = jQuery('.close-parent'); closeParentBtn.click(function(e){ closeParent(this); }); function closeParent(el) { jQuery(el).parent().slideUp(100); } } closeParentBtn(); // **********************************************************************// // ! Contact Form ajax // **********************************************************************// var eForm = $('#contact-form'); var spinner = jQuery('.spinner'); $('.required-field').focus(function(){ $(this).removeClass('validation-failed'); }); eForm.find('#submit').click(function(e){ e.preventDefault(); $('#contactsMsgs').html(''); spinner.show(); var errmsg; errmsg = ''; eForm.find('.required-field').each(function(){ if($(this).val() == '') { $(this).addClass('validation-failed'); } }); if(errmsg){ $('#contactsMsgs').html('

' + errmsg + '

'); spinner.hide(); }else{ url = eForm.attr('action'); data = eForm.serialize(); $.ajax({ url: url, method: 'GET', data: data, error: function(data) { $('#contactsMsgs').html('

Error while ajax request

'); spinner.hide(); }, success : function(data){ if (data.status == 'success') { $('#contactsMsgs').html('

' + data.msg + '

'); eForm.find("input[type=text], textarea").val(""); }else{ $('#contactsMsgs').html('

' + data.msg + '

'); } spinner.hide(); closeParentBtn(); } }); } }); // **********************************************************************// // ! Custom Comment Form Validation // **********************************************************************// var ethemeCommentForm = $('#commentform'); ethemeCommentForm.find('#submit').click(function(e){ $('#commentsMsgs').html(''); ethemeCommentForm.find('.required-field').each(function(){ if($(this).val() == '') { $(this).addClass('validation-failed'); e.preventDefault(); } }); }); // **********************************************************************// // ! Load in view // **********************************************************************// var counters = $('.animated-counter'); counters.each(function(){ $(this).waypoint(function(){ animateCounter($(this)); }, { offset: '100%' }); }); var progressBars = $('.progress-bars'); progressBars.waypoint(function() { i = 0; $(this).find('.progress-bar').each(function () { i++; var el = $(this); var width = $(this).data('width'); setTimeout(function(){ el.find('div').animate({ 'width' : width + '%' },400); el.find('span').css({ 'opacity' : 1 }); },i*300, "easeOutCirc"); }); }, { offset: '85%' }); // helper hex to rgb function componentToHex(c) { var hex = c.toString(16); return hex.length == 1 ? "0" + hex : hex; } function rgbToHex(r, g, b) { return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); } function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } $('.parallax .banner-bg').each(function(){ $(this).parallax('50%',0.05); }); if($(window).width() > 767) { $('.parallax-section').each(function(){ var speed = 0.1; if($(this).data('parallax-speed') != '') { speed = $(this).data('parallax-speed'); } $(this).parallax('50%', speed); }); } }); // document ready /* Plugin: jQuery Parallax Version 1.1.3 Author: Ian Lunn Twitter: @IanLunn Author URL: http://www.ianlunn.co.uk/ Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl.html */ (function( $ ){ var $window = $(window); var windowHeight = $window.height(); $window.resize(function () { windowHeight = $window.height(); }); $.fn.parallax = function(xpos, speedFactor, outerHeight) { var $this = $(this); var getHeight; var firstTop; var paddingTop = 0; //get the starting position of each element to have parallax applied to it $this.each(function(){ firstTop = $this.offset().top; }); if (outerHeight) { getHeight = function(jqo) { return jqo.outerHeight(true); }; } else { getHeight = function(jqo) { return jqo.height(); }; } // setup defaults if arguments aren't specified if (arguments.length < 1 || xpos === null) xpos = "50%"; if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; if (arguments.length < 3 || outerHeight === null) outerHeight = true; // function to be called whenever the window is scrolled or resized function update(){ var pos = $window.scrollTop(); $this.each(function(){ var $element = $(this); var top = $element.offset().top; var height = getHeight($element); var viewportBottom = pos + windowHeight; // Check if totally above or totally below viewport if (top + height < pos || top > viewportBottom) { return; } $this.css('backgroundPosition', xpos + " " + Math.round((top - viewportBottom) * speedFactor) + "px"); }); } $window.bind('scroll', update).resize(update); update(); }; })(jQuery); /* FILE ARCHIVED ON 13:55:59 Mar 08, 2018 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 09:46:17 Jan 06, 2020. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): RedisCDXSource: 4.653 CDXLines.iter: 31.559 (3) exclusion.robots: 0.377 captures_list: 132.237 exclusion.robots.policy: 0.355 esindex: 0.022 PetaboxLoader3.datanode: 105.074 (4) load_resource: 100.963 LoadShardBlock: 86.704 (3) PetaboxLoader3.resolve: 69.36 */