/* * Parabola theme frontend.js */ jQuery(document).ready(function() { /* Masonry */ parabola_activateMasonry(); /* Standard menu touch support for tablets */ var custom_event = ('ontouchstart' in window) ? 'touchstart' : 'click'; /* check touch support */ var ios = /iPhone|iPad|iPod/i.test(navigator.userAgent); jQuery( '#access .menu > ul > li a' ).on( 'click', function(e){ var link_id = jQuery(this).attr('href'); if (jQuery(this).closest('#access').data('clicked') == link_id) { /* second touch */ jQuery(this).closest('#access').data('clicked', null); } else { /* first touch */ if (custom_event != 'click' && !ios && (jQuery(this).parent().children('ul').length >0)) { e.preventDefault(); } jQuery(this).closest('#access').data('clicked', link_id); jQuery(this).next('.sub-menu').slideDown(); } }); /* Back to top button animation */ jQuery(function() { jQuery(window).on('scroll', function() { var x=jQuery(this).scrollTop(); var ver = getInternetExplorerVersion(); /* no fade animation (transparency) if IE8 or below */ if ( ver > -1 && ver <= 8 ) { if(x != 0) { jQuery('#toTop').show(); } else { jQuery('#toTop').hide(); } } /* fade animation if not IE8 or below */ else { if(x != 0) { jQuery('#toTop').fadeIn(3000); } else { jQuery('#toTop').fadeOut(); } } }); jQuery('#toTop').on('click', function() { jQuery('body,html').animate({scrollTop:0},800); }); }); /* Menu animation */ jQuery("#access > div > ul > li").on( 'mouseenter', function(){ if (jQuery(this).find('ul').length > 0) jQuery("#access > div > ul > li > ul").hide(); }); jQuery("#access ul ul").css({display: "none"}); /* Opera Fix */ jQuery("#access > .menu ul li > a:not(:only-child)").attr("aria-haspopup","true"); /* IE10 mobile Fix */ jQuery("#access li").on( 'mouseenter', function(){ jQuery(this).find('ul:first').stop(); jQuery(this).find('ul:first').css({opacity: "0"}).css({visibility: "visible",display: "none",overflow:"visible"}).slideDown({duration:400}).animate({"opacity":1},{queue:false}); }).on( 'mouseleave', function(){ jQuery(this).find('ul:first').css({visibility: "visible",display: "block",overflow:"visible"}).slideUp(150); }); /* Social Icons Animation */ jQuery(".socialicons").append('
'); jQuery(".socialicons").on('mouseenter', function(){ jQuery(this).find(".socials-hover").animate({"bottom":"0"},{queue:false,duration:150}); }).on('mouseleave', function() { jQuery(this).find(".socials-hover").animate({"bottom":"100%"},{queue:false,duration:150, complete: function() { jQuery(this).css({bottom:"-100%"}); } }); } ); /* Detect and apply custom class for Safari */ if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { jQuery('body').addClass('safari'); } }); /* end document.ready */ /* Masonry init, called on both ready and window.load */ function parabola_activateMasonry(){ if ( (parabola_settings.masonry==1) && ( typeof jQuery.fn.masonry !== 'undefined' )) { jQuery('body.magazine-layout .content-masonry').masonry({ itemSelector: 'article', columnWidth: 'article', percentPosition: true, }); } } /* Mobile Menu v2 */ function parabola_mobilemenu_init() { var state = false; jQuery("#nav-toggle").on('click', function(){ jQuery("#access").slideToggle(function(){ if (state) {jQuery(this).removeAttr( 'style' )}; state = ! state; } ); }); } /* Columns equalizer, used if at least one sidebar has a bg color */ function parabola_equalizeHeights(){ var h1 = jQuery("#primary").height(); var h2 = jQuery("#secondary").height(); var h3 = jQuery("#content").height(); var max = Math.max(h1,h2,h3); if (h1