jQuery(window).load(function(){ fixFooterBottom(); }); jQuery(window).resize(function(){ fixFooterBottom(); }); /* STICKY FOOTER */ function fixFooterBottom(){ var header = jQuery('header.header'); var footer = jQuery('footer.footer'); var content = jQuery('.content-wrap'); content.css('min-height', '1px'); var headerHeight = header.outerHeight(); var footerHeight = footer.outerHeight(); var contentHeight = content.outerHeight(); var windowHeight = jQuery(window).height(); var totalHeight = headerHeight + footerHeight + contentHeight; if (totalHeight 0 && jQuery(window).innerWidth() >= 767 ){ jQuery('.current').removeClass('current'); jQuery(alink).parent('li').addClass('current'); }else{ jQuery('.current').removeClass('current'); } if ( jQuery(window).innerWidth() >= 767 ) { headerHeight = jQuery('.sticky-navigation').outerHeight(); } else { headerHeight = 0; } if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = jQuery(this.hash); target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']'); if (target.length) { jQuery('html,body').animate({ scrollTop: target.offset().top - headerHeight + 10 }, 1200); return false; } } }); jQuery("#inpage_scroll_btn").click(function(event) { var anchor = jQuery('#inpage_scroll_btn').attr('data-anchor'); var offset = -60; jQuery('html, body').animate({ scrollTop: jQuery(anchor).offset().top + offset }, 1200); }); }); /*---------------------------------------*/ /* NAVIGATION AND NAVIGATION VISIBLE ON SCROLL /*---------------------------------------*/ function mainNav() { if(jQuery('.overlay-layer-nav').hasClass('sticky-navigation-open')){ return false; } var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; var topMenuClose = -70; var topMenuOpen = 0; if ( jQuery('.admin-bar').length>0 ) { $azera_shop_header_height = jQuery('.navbar').height(); topMenuClose = $azera_shop_header_height * -1; topMenuOpen = 32; } if ( top > 40 ) jQuery('.appear-on-scroll').stop().animate({ "opacity": '1', "top": topMenuOpen }); else jQuery('.appear-on-scroll').stop().animate({ "top": topMenuClose, "opacity": '0' }); } /* TOP NAVIGATION MENU SELECTED ITEMS */ function scrolled() { if ( jQuery(window).width() >= 751 ) { var azera_shop_scrollTop = jQuery(window).scrollTop(); // cursor position var headerHeight = jQuery('.sticky-navigation').outerHeight(); // header height var isInOneSection = 'no'; // used for checking if the cursor is in one section or not // for all sections check if the cursor is inside a section jQuery("section").each( function() { var thisID = '#' + jQuery(this).attr('id'); // section id var azera_shop_offset = jQuery(this).offset().top; // distance between top and our section var thisHeight = jQuery(this).outerHeight(); // section height var thisBegin = azera_shop_offset - headerHeight; // where the section begins var thisEnd = azera_shop_offset + thisHeight - headerHeight; // where the section ends // if position of the cursor is inside of the this section if ( azera_shop_scrollTop >= thisBegin && azera_shop_scrollTop <= thisEnd ) { isInOneSection = 'yes'; jQuery('.current').removeClass('current'); jQuery('#menu-primary a[href$="' + thisID + '"]').parent('li').addClass('current'); // find the menu button with the same ID section return false; } if (isInOneSection == 'no') { jQuery('.current').removeClass('current'); } }); } } var timer; jQuery(window).scroll(function(){ mainNav(); if ( timer ) clearTimeout(timer); timer = setTimeout(function(){ scrolled(); }, 500); }); var window_width_old; jQuery(document).ready(function(){ window_width_old = jQuery('.container').width(); if( window_width_old <= 462 ) { jQuery('.post-type-archive-product .products').azerashopgridpinterest({columns: 1,selector: '.product', calcMin: false}); jQuery('.cart-collaterals .products').azerashopgridpinterest({columns: 1,selector: '.product', calcMin: false}); } else if( window_width_old <= 750 ){ jQuery('.post-type-archive-product .products').azerashopgridpinterest({columns: 2,selector: '.product', calcMin: false}); jQuery('.cart-collaterals .products').azerashopgridpinterest({columns: 1,selector: '.product', calcMin: false}); } else { jQuery('.post-type-archive-product .products').azerashopgridpinterest({columns: 4,selector: '.product', calcMin: false}); jQuery('.cart-collaterals .products').azerashopgridpinterest({columns: 2,selector: '.product', calcMin: false}); } }); jQuery(window).resize(function() { if( window_width_old != jQuery('.container').outerWidth() ){ window_width_old = jQuery('.container').outerWidth(); if( window_width_old <= 462 ) { jQuery('.post-type-archive-product .products').azerashopgridpinterest({columns: 1,selector: '.product', calcMin: false}); jQuery('.cart-collaterals .products').azerashopgridpinterest({columns: 1,selector: '.product', calcMin: false}); } else if( window_width_old <= 750 ){ jQuery('.post-type-archive-product .products').azerashopgridpinterest({columns: 2,selector: '.product', calcMin: false}); jQuery('.cart-collaterals .products').azerashopgridpinterest({columns: 1,selector: '.product', calcMin: false}); } else { jQuery('.post-type-archive-product .products').azerashopgridpinterest({columns: 4,selector: '.product', calcMin: false}); jQuery('.cart-collaterals .products').azerashopgridpinterest({columns: 2,selector: '.product', calcMin: false}); } } }); (function ($, window, document, undefined) { var defaults = { columns: 3, selector: 'div', excludeParentClass: '', calcMin: true }; function AzeraShopGridPinterest(element, options) { this.element = element; this.options = $.extend({}, defaults, options); this.defaults = defaults; this.init(); } AzeraShopGridPinterest.prototype.init = function () { var self = this, $container = $(this.element); $select_options = $(this.element).children(); self.make_magic( $container, $select_options ); }; AzeraShopGridPinterest.prototype.make_magic = function (container) { var self = this; $container = $(container), columns_height = [], prefix = 'azera_shop', unique_class = prefix + '_grid_' + self.make_unique(); local_class = prefix + '_grid'; var classname; var substr_index = this.element.className.indexOf(prefix+'_grid_'); if( substr_index>-1 ) { classname = this.element.className.substr( 0, this.element.className.length-unique_class.length-local_class.length-2 ); } else { classname = this.element.className; } var my_id; if( this.element.id == '' ) { my_id = prefix+'_id_' + self.make_unique(); } else { my_id = this.element.id; } $container.after('
'); var i; for(i=1; i<=this.options.columns; i++){ columns_height.push(0); var first_cols = ''; var last_cols = ''; if( i%self.options.columns == 1 ) { first_cols = prefix + '_grid_first'; } if( i%self.options.columns == 0 ) { first_cols = prefix + '_grid_last'; } $('.'+unique_class).append('
'); } var calcMin = this.options.calcMin; var cols = this.options.columns; if( this.element.className.indexOf(local_class)<0 ){ $container.children(this.options.selector).each(function(index){ if(calcMin == true){ var min = Math.min.apply(null,columns_height); var this_index = columns_height.indexOf(min)+1; } else { this_index = index % cols + 1; } $(this).attr(prefix+'grid-attr','this-'+index).appendTo('.'+unique_class +' .' + prefix + '_grid_column_'+this_index); if(calcMin == true){ columns_height[this_index-1] = $('.'+unique_class +' .' + prefix + '_grid_column_'+this_index).height(); } }); } else { var no_boxes = $container.find(this.options.selector).length; var i; for( i=0; i a' ).after( '' ); // Toggle buttons and submenu items with active children menu items. container.find( '.current-menu-ancestor > button' ).addClass( 'toggled-on' ); container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' ); // Add menu items with submenus to aria-haspopup="true". container.find( '.menu-item-has-children' ).attr( 'aria-haspopup', 'true' ); container.find( '.dropdown-toggle' ).click( function( e ) { var _this = $( this ); e.preventDefault(); _this.toggleClass( 'toggled-on' ); _this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' ); _this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' ); _this.html( _this.html() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand ); }); } initMainNavigation( $( '.main-navigation' ) ); masthead = $( '#masthead' ); menuToggle = masthead.find( '#menu-toggle' ); siteHeaderMenu = masthead.find( '#site-header-menu' ); siteNavigation = masthead.find( '#site-navigation' ); // Enable menuToggle. ( function() { // Return early if menuToggle is missing. if ( ! menuToggle ) { return; } // Add an initial values for the attribute. menuToggle.click(function() { $( this ).add( siteHeaderMenu ).toggleClass( 'toggled-on' ); } ); } )(); // Fix sub-menus for touch devices and better focus for hidden submenu items for accessibility. ( function() { if ( ! siteNavigation || ! siteNavigation.children().length ) { return; } if ( 'ontouchstart' in window ) { siteNavigation.find( '.menu-item-has-children > a' ).on( 'touchstart.parallax-one', function( e ) { var el = $( this ).parent( 'li' ); if ( ! el.hasClass( 'focus' ) ) { e.preventDefault(); el.toggleClass( 'focus' ); el.siblings( '.focus' ).removeClass( 'focus' ); } } ); } siteNavigation.find( 'a' ).on( 'focus.parallax-one blur.parallax-one', function() { $( this ).parents( '.menu-item' ).toggleClass( 'focus' ); } ); } )(); // Add he default ARIA attributes for the menu toggle and the navigations. function onResizeARIA() { if ( 910 > window.innerWidth ) { if ( menuToggle.hasClass( 'toggled-on' ) ) { menuToggle.attr( 'aria-expanded', 'true' ); } else { menuToggle.attr( 'aria-expanded', 'false' ); } if ( siteHeaderMenu.hasClass( 'toggled-on' ) ) { siteNavigation.attr( 'aria-expanded', 'true' ); } else { siteNavigation.attr( 'aria-expanded', 'false' ); } menuToggle.attr( 'aria-controls', 'site-navigation social-navigation' ); } else { menuToggle.removeAttr( 'aria-expanded' ); siteNavigation.removeAttr( 'aria-expanded' ); menuToggle.removeAttr( 'aria-controls' ); } } $( document ).ready( function() { $( window ).on( 'load.parallax-one', onResizeARIA ) } ); } )( jQuery ); jQuery(document).ready( function(){ if( isMobile ) { fixed_responsive_bg_body(); } }); function fixed_responsive_bg_body() { if( jQuery('body').hasClass('custom-background') ) { var thisItem = jQuery('body.custom-background'); thisItem.prepend( '
' ); } } /* * Shopping cart */ ( function($) { $( '.woocommerce-page-title' ).unwrap(); /* footer fixed */ $( window ).load( fixFooterBottom ); $( window ).resize( fixFooterBottom ); function fixFooterBottom(){ var pageWidth = window.innerWidth; /* if page is less than 768px */ if (pageWidth > 768){ var bodyH = $( 'div.main' ).outerHeight(); var windowH = $( window ).outerHeight(); if ( bodyH < windowH ){ $( '.bottom-page-wrap' ).css({ 'position' : 'absolute', 'bottom' : '0', 'width' : '100%', 'z-index' : '9' }); $( 'div.main' ).height( windowH ); } }else{ $( '.bottom-page-wrap' ).css({ 'position' : 'relative' }); $( 'div.main' ).height( 'auto' ); } } $( '.header-search-button' ).click( function(event) { $( '.header-search' ).toggleClass( 'header-search-open' ); $( '.navbar-collapse').removeClass( 'in' ).attr( 'aria-expanded', 'false' ).css( 'height', '1px' ); $( '.navbar-toggle').attr( 'aria-expanded', 'false' ); $( '.navbar-toggle').addClass( 'collapsed' ); } ); $( '.header-search' ).click( function(event) { event.stopPropagation(); } ); $( 'html' ).click( function() { $( '.header-search' ).removeClass( 'header-search-open' ); } ); } )(jQuery,window);