Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lasse 10 posts 50 karma points
    Feb 18, 2014 @ 08:24
    Lasse
    0

    Problem with submenu with a specific number

    Hello Everybody

    I´m having a problem with my treemenu. I wan´t to style my vertical menu with CSS3 and JS. But I can't give my submenus a specific number with . (see my menu strukture on the images below)

    Is there another way to do it ? - PLEASE HELP ME

    enter image description here

  • Mads Jørgensen 74 posts 226 karma points
    Feb 18, 2014 @ 08:41
    Mads Jørgensen
    0

    Is it because you set

    <xsl:attribute name="class">child</xsl:attribute>
    

    And that overrides your class namer on your li's?

    Otherwise I'm not sure where you are trying to put in a number?

  • Mads Jørgensen 74 posts 226 karma points
    Feb 18, 2014 @ 08:42
    Mads Jørgensen
    0

    Your basic structure is rather OK actually,

  • Lasse 10 posts 50 karma points
    Feb 18, 2014 @ 08:45
    Lasse
    0

    Tak Mads

    I can't take credit for it. _When I have started at this company, they already had the website up and running. I am completely new to Umbraco.

    What is the right way to do it ?

    Lasse Link to the page : http://hsasystems.com/about-us.aspx

  • Lasse 10 posts 50 karma points
    Feb 18, 2014 @ 09:01
    Lasse
    0

    I wood like to put a number on my submenus. So it's easier to style

    Like this :

    <ul> 
    <li class="submenu1"><a href="#">Something</a></li> 
    <li class="submenu2"><a href="#">Info</a></li> 
    ect. 
    </ul>
    
  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Feb 18, 2014 @ 09:35
    Chriztian Steinmeier
    0

    Hi Lasse,

    It looks like you just need two small modifications (provided the rest works as expected):

    Set a default for the level parameter to make sure it starts at one if you don't explicitly set it:

    <xsl:param name="level" select="1" />
    

    And add the level to the class:

    <li class="submenu{$level}">
    

    /Chriztian

  • Lasse 10 posts 50 karma points
    Feb 18, 2014 @ 09:46
    Lasse
    0

    Thanks Chriztian

    That helped, but now they all named <li class="submenu3"> Why???

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Feb 18, 2014 @ 09:55
    Chriztian Steinmeier
    101

    Hi Lasse,

    Ah - okay - my bad; I misunderstood :)

    Use the position() function to grab the index for the current item in a for-each:

    <li class="submenu{position()}">
    

    /Chriztian

  • Mads Jørgensen 74 posts 226 karma points
    Feb 18, 2014 @ 09:56
    Mads Jørgensen
    0

    Hep,

    try this:

    <xsl:for-each select="[your select statement]">
        <li class="submenu{position() + 1}">
    [alt dit andet indhold]
        </li>
    </xsl:for-each>
    
  • Mads Jørgensen 74 posts 226 karma points
    Feb 18, 2014 @ 09:56
    Mads Jørgensen
    0

    Damn you Chriztian... Too fast :-)

  • Lasse 10 posts 50 karma points
    Feb 18, 2014 @ 10:00
    Lasse
    0

    TUSIND TAK DRENGE.

    Thank you so much - You just saved my day

    :-D

Please Sign in or register to post replies

Write your reply to:

Draft