(function($) { "use strict"; $(document).ready(function() { /*-----------------------------------------------------------------------------------*/ /* Home icon in main menu /*-----------------------------------------------------------------------------------*/ $('.main-navigation .menu-item-home > a').prepend(''); /*-----------------------------------------------------------------------------------*/ /* If the Tagcloud widget exist or Edit Comments Link exist /*-----------------------------------------------------------------------------------*/ if ( $( '.comment-metadata' ).length ) { $('.comment-metadata').addClass('smallPart'); } if ( $( '.comment-list .edit-link' ).length ) { $('.comment-list .edit-link').addClass('smallPart'); } /*-----------------------------------------------------------------------------------*/ /* Make dropdowns functional on focus /*-----------------------------------------------------------------------------------*/ $( '.main-navigation' ).find( 'a' ).on( 'focus blur', function() { $( this ).parents().toggleClass( 'focus' ); }); /*-----------------------------------------------------------------------------------*/ /* Top Search Button /*-----------------------------------------------------------------------------------*/ $('.top-search').click(function() { $('.topSearchForm').slideToggle('fast'); $(this).toggleClass("active"); return false; }); /*-----------------------------------------------------------------------------------*/ /* Overlay Effect for Featured Image /*-----------------------------------------------------------------------------------*/ $(".overlay-img").hover(function () { $(this).stop().animate({ opacity: .5 }, 300); }, function () { $(this).stop().animate({ opacity: 0 }, 300); }); /*-----------------------------------------------------------------------------------*/ /* Mobile Menu /*-----------------------------------------------------------------------------------*/ if ($( window ).width() < 769) { $('.main-navigation').find("li").each(function(){ if($(this).children("ul").length > 0){ $(this).append(""); } }); $('.main-navigation ul > li.menu-item-has-children .indicator, .main-navigation ul > li.page_item_has_children .indicator').click(function() { $(this).parent().find('> ul.sub-menu, > ul.children').toggleClass('yesOpen'); $(this).toggleClass('yesOpen'); var $self = $(this).parent(); if($self.find('> ul.sub-menu, > ul.children').hasClass('yesOpen')) { $self.find('> ul.sub-menu, > ul.children').slideDown(300); } else { $self.find('> ul.sub-menu, > ul.children').slideUp(200); } }); } /*-----------------------------------------------------------------------------------*/ /* Detect Mobile Browser /*-----------------------------------------------------------------------------------*/ if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { } else { /*-----------------------------------------------------------------------------------*/ /* Scroll To Top /*-----------------------------------------------------------------------------------*/ $(window).scroll(function(){ if ($(this).scrollTop() > 700) { $('#toTop').fadeIn(); } else { $('#toTop').fadeOut(); } }); $('#toTop').click(function(){ $("html, body").animate({ scrollTop: 0 }, 1000); return false; }); } }); })(jQuery);