WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Different image for each menu link
  • Print
Pages: [1]   Go Down

Author Topic: Different image for each menu link  (Read 5796 times)

Offline G4

  • Posts: 91
Different image for each menu link
« on: July 13, 2012, 11:57:40 AM »
How can I style each menu link like the following example? Is it possible to use page ID's?




« Last Edit: July 13, 2012, 12:01:41 PM by G4 »
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Different image for each menu link
« Reply #1 on: July 13, 2012, 12:52:05 PM »
Try the following example with show_menu2()

Code: [Select]

<?php show_menu2(0, SM2_ROOT, SM2_START+1,SM2_TRIM, '[li]<a href="[url]" class="menu-[page_id]">[menu_title]</a>' ); ?>

It should give a class "menu-nn" in the <a> tag.
« Last Edit: July 13, 2012, 02:51:42 PM by Argos »
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline G4

  • Posts: 91
Re: Different image for each menu link
« Reply #2 on: July 13, 2012, 03:29:27 PM »
It does not work. What am I doing wrong?

Output:
Code: [Select]
<ul class="menu-top"><li class="menu-expand menu-current menu-first"><a href="http://www.mysite.nl/testpage/" class="menu-22">Menulink 1 &gt;</a><ul class=""><li class="menu-child menu-first"><a href="http://www.mysite.nl/testpage/pages/Menulink 1/Sublink A.php" class="menu-24">Sublink A</a></li><li class="menu-child"><a href="http://www.mysite.nl/testpage/pages/Menulink 1/Sublink B.php" class="menu-25">Sublink B</a>
etc.

Stylesheet:
Code: [Select]
/* MENU  */
.menu{float:left;font-size:14px;width:220px;height:auto;margin:1px 0 0 0;text-align:left;font-weight:bold;line-height:18px;background-color:#fff}
.menu ul{border-top:0;list-style-type:none;padding:0;margin:0}
.menu ul ul{text-decoration:none;border:0;padding:0;margin:0}
.menu li{border:0;border-bottom:1px solid #fcb816}
.menu ul ul li{border:0;border-top:1px solid #7A7A7C}
.menu ul ul a{border-left:solid 5px #7A7A7C;color:#000}
.menu a{color:#f79b17}
.menu a:link, .menu a:visited, .menu a:active{padding:2px 10px 4px 10px;display:block;text-decoration:none;padding-top:4px}
.menu a:hover{display:block;color:#fff;background-color:#f79b17}
.menu_current a{color:#fff;font-weight:bold;background-color:#f79b17}
 
/* ID 24 */
.menu-24{float:left;font-size:14px;width:220px;height:auto;margin:1px 0 0 0;text-align:left;font-weight:bold;line-height:18px;background-color:#fff}
.menu-24 ul{border-top:0;list-style-type:none;padding:0;margin:0}
.menu-24 ul ul{text-decoration:none;border:0;padding:0;margin:0}
.menu-24 li{border:0;border-bottom:1px solid red}
.menu-24 ul ul li{border:0;border-top:1px solid red}
.menu-24 ul ul a{border-left:solid 5px red;color:#000}
.menu-24 a{color:red}
.menu-24 a:link, .menu-22 a:visited, .menu-22 a:active{padding:2px 10px 4px 10px;display:block;text-decoration:none;padding-top:4px}
.menu-24 a:hover{display:block;color:red;background-color:red}
.menu-22_current a{color:red;font-weight:bold;background-color:red}
« Last Edit: July 13, 2012, 03:31:00 PM by G4 »
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Different image for each menu link
« Reply #3 on: July 13, 2012, 04:09:03 PM »
The menu-nn class is in the <a> link.
So the .menu styling is for defaults and positioning.

Remove the .menu-nn styles in your example.
Just set the color with:

Code: (untested) [Select]
.menu li a.menu-24 { color: red; }
.menu li a.menu-24:hover { whatever hover action }
.menu li.menu_current a.menu-24 { whatever current action }
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline G4

  • Posts: 91
Re: Different image for each menu link
« Reply #4 on: July 13, 2012, 06:38:13 PM »
Thank you! Also for the explanation.
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Different image for each menu link
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2