jQuery(document).foundation(); jQuery(document).ready(function(){ jQuery('body').on('click','#header .search-form-cover',function(){ if (!jQuery('#header').hasClass('show-search')){jQuery('#header').addClass('show-search');jQuery(this).find('input').trigger('focus');} }); jQuery('body').on('click','#header #mobile-menu',function(){ if (!jQuery('#header #top-nav').hasClass('active')){jQuery('#header #top-nav').addClass('active');} }); jQuery('body').on('click','.apricot_recent_posts .widgettitle > span',function(){ var index = jQuery(this).index(); jQuery(this).parent().parent().find('.apricot_recent_posts_cover > .active').removeClass('active'); jQuery(this).parent().parent().find('.apricot_recent_posts_cover > ul').eq(index).addClass('active'); jQuery(this).parent().find('span.active').removeClass('active'); jQuery(this).addClass('active'); }); if (jQuery('.apricot_gallery > .slider-gallery').length!=0) { jQuery('.apricot_gallery > .slider-gallery').show().slick({ //'dots': true, 'adaptiveHeight': true, 'prevArrow': '', 'nextArrow': '' }); } jQuery('[href="?color='+encodeURIComponent(window.theme_color)+'"]').parent().addClass('current-menu-item-fake'); jQuery('[href="?box='+encodeURIComponent(window.box_layout)+'"]').parent().addClass('current-menu-item-fake'); jQuery('[href="?layout='+encodeURIComponent(window.theme_columns)+'"]').parent().addClass('current-menu-item-fake'); jQuery('[href="?sidebar='+encodeURIComponent(window.sidebar_home)+'"]').parent().addClass('current-menu-item-fake'); jQuery(document).on('submit','.apricot_form',function(event){ event.preventDefault(); var data = jQuery(this).serialize(); jQuery(this).find('.response').text('').removeClass('error success'); jQuery(this).find('.submit').val('...').attr('disabled','disabled'); jQuery.ajax({ url: apricot.ajaxurl, type: "POST", context: jQuery(this), data: 'action=apricot_form_submit&'+data, dataType: 'json', success: function (response) { jQuery(this).find('.submit').val(jQuery(this).find('.submit').attr('data-text')).removeAttr('disabled'); if (response.error) { jQuery(this).find('.response').text(response.error).addClass('error'); } if (response.success) { jQuery(this).find('.response').text(response.success).addClass('success'); jQuery(this).find('.main-form').slideUp('fast'); } }, error: function (response) { } }); }); }); jQuery(document).mouseup(function (e) { var container = jQuery("#header .search-form-cover"); if (!container.is(e.target) && container.has(e.target).length === 0) { jQuery("#header").removeClass('show-search'); } var container = jQuery("#header #top-nav"); if (!container.is(e.target) && container.has(e.target).length === 0) { jQuery("#header #top-nav").removeClass('active'); } }); jQuery(window).scroll(function(){ if (jQuery(window).scrollTop() > 117) { if (!jQuery('body').hasClass('fixed')) { jQuery('body').addClass('fixed').removeClass('static'); } } else { if (jQuery('body').hasClass('fixed')) { jQuery('body').removeClass('fixed').addClass('static'); } } if (jQuery(window).scrollTop() > 117) { if (!jQuery('body').hasClass('mobile-fixed')) { jQuery('body').addClass('mobile-fixed').removeClass('mobile-static'); } } else { if (jQuery('body').hasClass('mobile-fixed')) { jQuery('body').removeClass('mobile-fixed').addClass('mobile-static'); } } });