adgsm / multi-level-push-menu

MultiLevelPushMenu jQuery Plugin implementation
http://multi-level-push-menu.dzunic.net
804 stars 213 forks source link

Back text as a parent #175

Closed levipadre closed 7 years ago

levipadre commented 7 years ago

Hi,

Is there a way to show the parent Title in the "back link" section? I need to show the parent name instead of the Back text.

Thanks!

adgsm commented 7 years ago

Well there is definitely, but this is more about jQuery... Try something as following.

    $( '#menu' ).multilevelpushmenu({
        onMenuReady: function( plugin ){
            var $backElements = $( 'div.backItemClass' );
            $.each( $backElements , function( index , element ){
                var $backTextElement = $( element ).parents( 'div.levelHolderClass' ).eq(1);
                $( element ).find( 'a' ).first().html( ( ( $backTextElement.length > 0 ) ? $backTextElement.children( 'h2' ).text() : 'N/A' ) );
            } );
        }
    });