second line in a menu item

Support desk for Multipurpose Quark Theme
GK User
Mon Sep 12, 2016 8:53 am
Hello there, could you tell me how could I achieve the effect of a second line in the main menu such in othere templates of yours.
In some of them you can add [br] to the menu item name and the rest of the name will split on two lines.
The Quark template doesn't recognize this, neither I could use html in the name (something like <br /> or <span class="second line"></span>).
Could you advise me how achieve this functionality.

Thank you in advance
User avatar
Fresh Boarder

teitbite
Thu Sep 15, 2016 11:25 am
Hi

Please try add this to /layout/blocks/head.php

Code: Select all
<script type="text/javascript">(function($) {$(document).ready(function() {
$('#gkPageTop .gkMenu > ul > li > a').each(function(){
   var elem = '';
   var words = $(this).html().split(' ');
   $.each(words, function( index, value ) {
      //alert( index + ": " + value );
      elem += value;
      if(index==0) {
         elem += '<br />';
      } else {
         elem += ' ';
      }
   });
   $(this).html( elem.trim() );
});
});})(jQuery)</script>
User avatar
Moderator

GK User
Fri Sep 16, 2016 1:46 pm
Thank you, I'll try this.
User avatar
Fresh Boarder

GK User
Sat Sep 17, 2016 4:57 am
It worked with a little bit of tweaking. I don't know js but I figured it out.
First - the path to the file is layouts/blocks/head.php
The changed code:
Code: Select all
<script type="text/javascript">(function($) {$(document).ready(function() {
    $('#aside-menu .gkAsideMenu > ul > li > ul > li > a').each(function(){
       var elem = '';
       var words = $(this).html().split('[br]');
       $.each(words, function( index, value ) {
          //alert( index + ": " + value );
          elem += value;
          if(index==0) {
             elem += '<br />';
          } else {
             elem += ' ';
          }
       });
       $(this).html( elem.trim() );
    });
    });})(jQuery)</script>
User avatar
Fresh Boarder

teitbite
Sun Sep 18, 2016 1:03 pm
Hi

With this code only submenu will be separated, but if it was what You needed than I'm glad You've been able to figure that out.
User avatar
Moderator


cron