Copied to clipboard

Flag this post as spam?

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


  • Djan Blom 99 posts 161 karma points
    Mar 24, 2011 @ 12:20
    Djan Blom
    0

    Multilevel Menu and jQuery dropdown help plz.

    Hi all,

    Im currently working on this solution, http://djan.v5.baseshop.dk/1386.aspx.

    Before, I used the TopNavigation with no problems.

    But i want to ad a dropdown for my menu, so that the subpages drop down from underneath.

    I used the Multi Level Navigation, but it doesnt read anything out?

    here's my xslt :

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:Stylesheet [
      <!ENTITY nbsp "&#x00A0;">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="msxml umbraco.library">


      <xsl:output method="xml" omit-xml-declaration="yes"/>


      <xsl:param name="currentPage"/>
      <xsl:param name="startLevel" select="1"/>

      <xsl:template match="/">


        <xsl:if test="count($currentPage/ancestor-or-self::node
    [@level = $startLevel]/node [string(./data [@alias='umbracoNaviHide'])
    != '1']) &gt; 0"
    >
          <span class="h1">Menu</span>
          <div id="LeftMenu">
            <ul class="nav">

              <xsl:for-each select="$currentPage/ancestor-or-self::node [@level = $startLevel]/node [string(data [@alias='umbracoNaviHide']) != '1']">
                <xsl:call-template name="drawnode">
                  <xsl:with-param name="level" select="1"/>
                </xsl:call-template>
              </xsl:for-each>
            </ul>
          </div>

        </xsl:if>
        <xsl:if test="count($currentPage/ancestor-or-self::node [@level = $startLevel]/node [string(./data [@alias='umbracoNaviHide']) != '1']) = 0">
          <div id="LeftMenu">&nbsp;</div>
        </xsl:if>
      </xsl:template>

      <xsl:template name="drawnode">
        <xsl:param name="level"/>
        <xsl:if test="string(./data [@alias='umbracoNaviHide']) != '1'">
          <li>
            <xsl:choose>
              <xsl:when test="@id=$currentPage/@id">
                <xsl:attribute name="class">
                  level<xsl:value-of select="$level"/>selected
                </xsl:attribute>
              </xsl:when>
              <xsl:otherwise>
                <xsl:attribute name="class">
                  level<xsl:value-of select="$level"/>
                </xsl:attribute>
              </xsl:otherwise>
            </xsl:choose>


            <a href="{umbraco.library:NiceUrl(@id)}" title="Gå til {@nodeName}">
              <xsl:value-of select="@nodeName"/>
            </a>

          </li>
        </xsl:if>

        <xsl:if test="count(descendant-or-self::node [@id=$currentPage/@id]) > 0">
          <xsl:for-each select="node">
            <xsl:call-template name="drawnode">
              <xsl:with-param name="level" select="number($level)+1"/>
            </xsl:call-template>
          </xsl:for-each>
        </xsl:if>
      </xsl:template>

    </xsl:stylesheet>

     

    I found this neat little javascript, and with a few tweaks I think it should do the trick.

    http://javascript-array.com/scripts/jquery_simple_drop_down_menu/

     

    Thanks,
    Djan

Please Sign in or register to post replies

Write your reply to:

Draft