templates/blog/asset/js/main.js
/**
* Setting up functionality for alternative menu
* @since Blogberg 1.0.0
*/
Setting up functionality for alternative menu
Setting up functionality for alternative menu
function wpMenuAccordion( selector ){
	var $ele = selector + ' .menu-item-has-children > a';
	$( $ele ).each( function(){
		var text = $( this ).text();
		text = text + '<span class="kfi kfi-arrow-carrot-down-alt2 triangle"></span>';
		$( this ).html( text );
	});
	$( document ).on( 'click', $ele + ' span.triangle', function( e ){
		e.preventDefault();
		e.stopPropagation();
		$parentLi = $( this ).parent().parent( 'li' );
		$childLi = $parentLi.find( 'li' );
		if( $parentLi.hasClass( 'open' ) ){
			$parentLi.removeClass( 'open' );
			$childLi.removeClass( 'open' );
			$( this ).parent( 'a' ).next().slideUp();
			$( this ).parent( 'a' ).next().find( 'ul' ).slideUp();
		}else{
			$parentLi.addClass( 'open' );
			$( this ).parent( 'a' ).next().slideDown();
		}
	});
}
function wpMenuAccordion ( selector ) { var $ele = selector + ' .menu-item-has-children > a' ; $ ( $ele ) . each ( function ( ) { var text = $ ( this ) . text ( ) ; text = text + '<span class="kfi kfi-arrow-carrot-down-alt2 triangle"></span>' ; $ ( this ) . html ( text ) ; } ) ; $ ( document ) . on ( 'click' , $ele + ' span.triangle' , function ( e ) { e . preventDefault ( ) ; e . stopPropagation ( ) ; $parentLi = $ ( this ) . parent ( ) . parent ( 'li' ) ; $childLi = $parentLi . find ( 'li' ) ; if ( $parentLi . hasClass ( 'open' ) ) { $parentLi . removeClass ( 'open' ) ; $childLi . removeClass ( 'open' ) ; $ ( this ) . parent ( 'a' ) . next ( ) . slideUp ( ) ; $ ( this ) . parent ( 'a' ) . next ( ) . find ( 'ul' ) . slideUp ( ) ; } else { $parentLi . addClass ( 'open' ) ; $ ( this ) . parent ( 'a' ) . next ( ) . slideDown ( ) ; } } ) ; }
Setting up functionality for alternative menu
Setting up functionality for alternative menu
/**
			* Closing all the ul inside and 
			* removing open class for all the li's
			*/