Xuups
Get an account!     Login

Utilities

Main menu

Who's Online

5 user(s) are online (1 user(s) are browsing Hacks and Tips)

Members: 0
Guests: 5

more...

Get Xoops

Support Xuups Project

Core :  Main menu hack - on click submenus
Tags: hack   mainmenu   submenus  
 
Hi, I have made a simple hack that will hide your submenus and only display them on click.

It requires hacking just one file:
modules/system/templates/blocks/system_block_mainmenu.html

<table cellspacing="0">
  <
tr>
    <
td id="mainmenu">
      <
class="menuTop" href="<{$xoops_url}>/"><{$block.lang_home}></a>
      <!-- 
start module menu loop -->
      <{foreach 
item=module from=$block.modules}>
      <
class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/">
      <{
$module.name}></a>
      <{if 
$module.sublinks}>
      <
div style="margin-top:-18px;margin-right:5px;float:right;">
        <
img src="<{$xoops_url}>/modules/system/images/check.gif" onclick="togglemenuSub();"/>
      </
div>
      <
div id="menuSub" style="display:none;">
      <{/if}>
        <{foreach 
item=sublink from=$module.sublinks}>
          <
class="menuSub" href="<{$sublink.url}>"><{$sublink.name}></a>
        <{/foreach}>
      <{if 
$module.sublinks}></div><{/if}>
      <{/foreach}>
      <!-- 
end module menu loop -->
    </
td>
  </
tr>
</
table>
<
script type="text/javascript">
<!--
function 
togglemenuSub() {
    
obj1=document.getElementById('menuSub');
    
obj1.style.display = (obj1.style.display != "block") ? "block" "none";
}
//-->
</script>


You may have to adjust margin and image to best fit in your theme.

Thanks!


TDM

Author
trabis
Author trabis
News by the same authorMore stories
Author rssAuthor rss
StatisticsStatistics
 
Story
Date 2008/9/3 15:10:57
Views 3630
Favorites 1
Send this Story to a FriendSend
Printer Friendly PagePrint
Create a PDF from the articleCreate a pdf
 
Bookmarks
         
         
         
         
         
     
Recents
How to sucessfuly add scripts in your Xoops Themes
Query timers on debug for xoops 2.3
Highlighting current module on mainMenu
Main menu hack - on click submenus
Preventing empty blocks to display
Random
Query timers on debug for xoops 2.3
Highlighting current module on mainMenu
Main menu hack - on click submenus
Preventing empty blocks to display
Hacking Multimenu - Selected menus
The comments are owned by the poster. We aren't responsible for their content.
Poster Thread
Themis
Posted: 2009/6/16 9:21  Updated: 2009/6/16 9:58
Just popping in
Joined: 2008/6/1
From: Greece
Posts: 12
 Re: Main menu hack - on click submenus
Hey, this is a nice hack...!!!
I think I will implement this at my site.
Could you please submit a photo/image to see how it looks?

I think that posting images is a good idea.
Take a look at my post: http://www.xuups.com/modules/mynews/article.php?storyid=3
I used Imageshack to store the image, so that you don't encounter any problems with your bandwidth.
 

Login

Username:

Password:

Remember me



Lost Password?

Register now!

Ajax Search


Advanced Search

Sub menu

Last comments