jQuery(document).ready(function(){ //set sidebar height to match height of content on page if(jQuery(".page-node-type-page .main-container section").height() > jQuery(".page-node-type-page .main-container aside").height()) { jQuery(".page-node-type-page .main-container aside").css({'height':(jQuery(".page-node-type-page .main-container section").height()+'px')}); } if(jQuery(".path-people .main-container section").height() > jQuery(".path-people .main-container aside").height()) { jQuery(".path-people .main-container aside").css({'height':(jQuery(".path-people .main-container section").height()+'px')}); } //adds fontawesome arrow to menu //check if is iPhone function isiPhone(){ return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) ); } //check if menu in mobile view if (jQuery('#superfish-main-accordion')[0]){ jQuery('.sf-accordion-button .svg-inline--fa').empty().replaceWith(function(){ return jQuery("<i class='fa fa-angle-down' aria-hidden='true' />").append(jQuery(this).contents()); }); //change arrow direction on click jQuery('.sf-accordion-button').click(function(){ if ( jQuery(this).find("svg").hasClass('fa-angle-down') ) { jQuery(this).find("svg").addClass( 'fa-angle-right' ); } else { jQuery(this).find("svg").removeClass( 'fa-angle-right' ).addClass( 'fa-angle-down' ); } if ( jQuery(this).find("i").hasClass('fa-angle-down') ) { jQuery(this).find("i").removeClass('fa-angle-down').addClass( 'fa-angle-right' ); } else { jQuery(this).find("i").removeClass( 'fa-angle-right' ).addClass( 'fa-angle-down' ); } }); //character limit in mobile view for slide text title /*if (jQuery(".slide-txt h2").html().length > 25){ // }*/ } else { jQuery('.sf-sub-indicator').empty().replaceWith(function(){ return jQuery("<i class='fa fa-angle-right' aria-hidden='true' />").append(jQuery(this).contents()); }); } //accordions change fontawesome character jQuery(".panel-title").click(function(){ //jQuery(this).find("svg").toggleClass('fa-angle-up', addOrRemove); if ( jQuery(this).find("svg").hasClass('fa-angle-down') ) { jQuery(this).find("svg").addClass( 'fa-angle-up' ); } else { jQuery(this).find("svg").removeClass( 'fa-angle-up' ).addClass( 'fa-angle-down' ); } if ( jQuery(this).find("i").hasClass('fa-angle-down') ) { jQuery(this).find("i").removeClass('fa-angle-down').addClass( 'fa-angle-up' ); } else { jQuery(this).find("i").removeClass( 'fa-angle-up' ).addClass( 'fa-angle-down' ); } }); //add class to last accordion in group jQuery(".paragraph--type--accordion .panel:last-child").addClass( 'yell' ); //open search form in main menu jQuery(".active-search").click(function() { jQuery(".search-block-form").toggle(); jQuery(".search-block-form input[type='text']").focus(); }); //checking if logos exist and setting up header jQuery('#dep-logo-img').on('error', function(){ jQuery('.dep-logo img').replaceWith('<img src="/themes/asc_bootstrap/images/logos/demo-logos/department-logo.svg"/>'); jQuery('#header-logos-mobile .dep-logo img').replaceWith('<img src="/themes/asc_bootstrap/images/logos/demo-logos/department-logo-mobile.svg"/>'); }); //clear search box on people directory on user focus jQuery('#views-exposed-form-people-directory-page-1 #edit-combine').focus(function(){ jQuery('#edit-combine').val(''); jQuery(this).blur(function(){ jQuery('#views-exposed-form-people-directory-page-1').submit(); }); }); //add class if people directory /*if ( jQuery('#block-exposedformpeople-directorypage-1').length ) { jQuery('aside.col-sm-3').addClass('col-sm-push-9'); jQuery('section.col-sm-9').addClass('col-sm-pull-3'); }*/ if (jQuery(".sidebar-nav .active-trail").length) { jQuery(".sidebar-nav .active-trail").find("i").removeClass('fa-angle-right').addClass( 'fa-angle-down' ); } jQuery(".sidebar-nav li").click(function(e){ e.stopPropagation(); if ( jQuery(this).find("ul").css('display') == 'none' ) { jQuery(this).find("i").removeClass('fa-angle-right').addClass( 'fa-angle-down' ); } else { jQuery(this).find("i").removeClass( 'fa-angle-down' ).addClass( 'fa-angle-right' ); } jQuery(this).find("ul").slideToggle(); }); if (jQuery(".is-active").length) { jQuery( ".is-active" ).parent().addClass( "active-link" ); } });