jQuery(function($){ $(document).ready(function(){ /*search toggle*/ function wpexSearchToggle() { $(".header-one #header-search-toggle").click(function(){ if ( $("#header-search").is(":visible") ) { $(this).removeClass('active'); $("#header-search").stop(true,true).fadeOut(); $("#navigation").stop(true,true).fadeIn(); } else { $(this).addClass('active'); $("#header-search").stop(true,true).fadeIn(); $("#header-search input").focus() $("#navigation").stop(true,true).fadeOut(); } return false; }); $(document).click(function(e) { if ( $(e.target).closest('.header-one #header-search').length === 0 ) { $(".header-one #header-search-toggle").removeClass('active'); $(".header-one #header-search").stop(true,true).fadeOut(); $(".header-one #navigation").stop(true,true).fadeIn(); } }); } /* Show blog entry videos => prevents "flash" */ $('.blog-entry-video').fadeIn(); /*Extended alert style*/ function wpexExtendedBoxes() { var bodyWidth = $('body').width(); var wrapWidthHalf = $('.boxed:first-child').outerWidth()/2; $('body.full-layout .symple-box.extended').css({ width: bodyWidth, marginLeft: -bodyWidth/2 + wrapWidthHalf }); } /*tooltip*/ $('.tooltipster, .tooltipster-parent a').tooltipster({ animation: 'fade', Default: 50 }); /*superFish*/ function wpexSuperFishInit() { $("ul.sf-menu").superfish({ autoArrows: false, dropShadows: false, animation: {height:'show'}, animationOut: {height:'hide'}, speed: 'fast', speedOut: 'fast' }); } /*fancybox lightbox*/ function wpexFancyBoxInit() { $(".fancybox").fancybox({ helpers : { title : { type : 'inside' } } }); $('.fancybox-media').fancybox({ helpers : { media : {}, title : { type : 'inside' } } }); } /*animate comments scroll*/ function wpexCommentScroll() { $(".comments-scroll a").click(function(event){ event.preventDefault(); $('html,body').animate({ scrollTop:$(this.hash).offset().top}, 'normal' ); }); } /*back to top link*/ function wpexTopLink() { $("a.scrolltop").click(function(event){ event.preventDefault(); $('html,body').animate({ scrollTop:0 }, 'fast' ); }); } /* Fade Items on Hover */ function wpexItemsFade() { $(".fade-items").delegate(".fade-me", "mouseover mouseout", function(e) { if (e.type == 'mouseover') { $(".fade-items .fade-me").not(this).dequeue().animate({opacity: "0.40"}, "normal"); } else { $(".fade-items .fade-me").not(this).dequeue().animate({opacity: "1"}, "normal"); } }); } /* Image Post Format overlay */ $('.image-format-link').hover( function() { $(this).children('.image-format-overlay').stop(true,true).fadeIn('fast'); }, function() { $(this).children('.image-format-overlay').stop(true,true).fadeOut('fast') }); /*Show overlay on hover*/ function wpexPortfolioOverlayHover() { $(".portfolio-entry-media").hover(function(){ /*set variables*/ var $overlay = $(this).find(".portfolio-entry-overlay"); var $overlayIcon = $overlay.find(".overlay-icon"); /*fadein overlay*/ $overlay.stop(true, true).fadeIn('fast') /*center overlay icon*/ $overlayIcon.stop(true,true).animate({ top: $overlay.outerHeight()/2 }) }, function(){ /*set variables*/ var $overlay = $(this).find(".portfolio-entry-overlay"); var $overlayIcon = $overlay.find(".overlay-icon"); /*fade out the overlay*/ $overlay.stop(true,true).fadeOut('fast'); /*move overlay icon back to -40px*/ $overlayIcon.stop(true,true).animate({ top: -40 }) }); } /*Initiate functions*/ wpexSearchToggle(); wpexSuperFishInit(); wpexFancyBoxInit(); wpexCommentScroll(); wpexTopLink(); wpexPortfolioOverlayHover(); }); /* END Doc Ready */ $(window).load(function() { /*page image overlay*/ function wpexPageImgOverlay() { $('#page-featured-img-overlay').css('display', 'block'); $('#page-featured-img-overlay').animate({ opacity: 0 }, 0); var $featImgHeight = $('#page-featured-img').outerHeight()/2; var $featImgOverlayHeight = $('#page-featured-img-overlay').outerHeight()/2; $('#page-featured-img-overlay').delay(300).animate({ opacity: 1, top: $featImgHeight - $featImgOverlayHeight }); } function wpexRecalcOverlayPos() { var $featImgHeight = $('#page-featured-img').outerHeight()/2; var $featImgOverlayHeight = $('#page-featured-img-overlay').outerHeight()/2; $('#page-featured-img-overlay').css({ top: $featImgHeight - $featImgOverlayHeight }); } /* Initiate functions */ wpexPageImgOverlay(); /* On Resize */ $(window).resize(function() { wpexRecalcOverlayPos(); }); /* On Orientation Change */ if(jQuery.browser.version.substring(0, 2) !== "8.") { window.addEventListener("orientationchange", function() { wpexRecalcOverlayPos(); }); } }); /* END Win Ready */ });