We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4429
    • 429 Posts
    I am currently using the basic dropdown menu found on the muddypaws site.

    The menu is working fine, but for some reason I cannot get the active class to work.


    Here is the html output of the menu as created by wayfinder:

    <!---- start Nav ---->	
    <div class="menu">
        <ul>
            <li><a  href="http://www.naturediet.co.uk/" title="HOME">HOME</a></li>
    <li><a   class="hide" href="http://www.naturediet.co.uk/products.html" title="PRODUCTS">PRODUCTS</a>
        <!--[if lte IE 6]>
        <a class="sub" href="http://www.naturediet.co.uk/products.html" title="PRODUCTS">PRODUCTS
        <table><tr><td>
        <![endif]-->
    
        <ul>
        <li><a  href="http://www.naturediet.co.uk/feedingguide.html" title="Interactive Feeding Guide">Interactive Feeding Guide</a></li>
    <li class="last"><a  href="http://www.naturediet.co.uk/products2.html" title="Products">Products</a></li>
    
    </ul>
    
        <!--[if lte IE 6]>
    	</td></tr></table>
        </a>
        <![endif]-->
    </li>
    
    <li><a  href="http://www.naturediet.co.uk/stockists.html" title="STOCKISTS">STOCKISTS</a></li>
    <li><a   class="hide" href="http://www.naturediet.co.uk/advice.html" title="ADVICE">ADVICE</a>
    
        <!--[if lte IE 6]>
        <a class="sub" href="http://www.naturediet.co.uk/advice.html" title="ADVICE">ADVICE
        <table><tr><td>
        <![endif]-->
        <ul>
        <li><a  href="http://www.naturediet.co.uk/adviceFAQ.html" title="FAQs">FAQs</a></li>
    <li><a  href="http://www.naturediet.co.uk/advicefactsheets.html" title="Fact Sheets">Fact Sheets</a></li>
    <li><a  href="http://www.naturediet.co.uk/adviceadultfeedingguide.html" title="Adult Feeding Guide">Adult Feeding Guide</a></li>
    <li class="last"><a  href="http://www.naturediet.co.uk/advicepuppyfeedingguide.html" title="Puppy Feeding Guide">Puppy Feeding Guide</a></li>
    
    </ul>
    
        <!--[if lte IE 6]>
    	</td></tr></table>
        </a>
        <![endif]-->
    
    </li>
    
    <li><a   class="hide active" href="/index.php?q=news" title="NEWS">NEWS</a>
        <!--[if lte IE 6]>
        <a class="sub" href="/index.php?q=news" title="NEWS">NEWS
        <table><tr><td>
        <![endif]-->
        <ul>
        <li class="hide"><a  href="/index.php?q=current" title="Current News">Current News</a></li>
    <li class="hide"><a  href="/index.php?q=archive" title="Archive">Archive</a></li>
    <li class="hide"><a  href="/index.php?q=sponsored-news" title="Sponsored News">Sponsored News</a></li>
    <li class="last hide"><a  href="/index.php?q=testimonials" title="Testimonials">Testimonials</a></li>
    
    </ul>
    
        <!--[if lte IE 6]>
    	</td></tr></table>
        </a>
        <![endif]-->
    </li>
    
    <li class="last"><a  href="http://www.naturediet.co.uk/contact.html" title="CONTACT">CONTACT</a></li>
    
        </ul>
    </div>
    


    As you can see the NEWS page is currently active. So I set up a .active class in my stylesheet.

    .menu {
    	width:750px;
    	list-style:none;
    	height:50px;
    margin: 0;
    padding: 0;
    font-family: geneva;
    }
    
    
    /* remove the bullets and set the margin and padding to zero for the unordered list */
    .menu ul {
    padding:0; 
    margin:0;
    list-style-type: none;
    }
    /* float the list so that the items are in a line and their position relative so that the drop down list will appear in the right place underneath each list item */
    .menu ul li {
    float:left; 
    position:relative;
    }
    /* style the links to be 113px wide by 30px high with a top and right border 1px solid white. Set the background color and the font size. */
    .menu ul  a, .menu ul  a:visited {
    display:block; 
    text-align:left; 
    text-decoration:none; 
    text-indent:5px;
    width:113px; 
    height:30px; 
    color:#e1f5e7; 
    /*border:1px solid #fff;
    border-width:1px 1px 0 0;  */
    background:#7fb790;  
    line-height:30px; 
    margin: 10px 3px 0px 8px;
    }
    
    
    
    .menu li a {
    font-size: 13.5px;
    }
    
    
    
    
    
    /* make the dropdown ul invisible */
    .menu ul li ul {
    display: none;
    }
    
    /* specific to non IE browsers */
    /* set the background and foreground color of the main menu li on hover */
    .menu ul li:hover a {
    color:#e1f5e7; 
    background: #7fb790 url(paw.png);
    }
    
    
    
    
    
    
    /* make the sub menu ul visible and position it beneath the main menu list item */
    .menu ul li:hover ul {
    display:block; 
    position:absolute; 
    top:40px; 
    left:0; 
    }
    /* style the background and foreground color of the submenu links */
    .menu ul li:hover ul li a {
    display:block; 
    background:#7fb790; 
    color:#fff;
    margin-left: 7px;
    margin-top: 0px;
    margin-bottom: 0px;
    border: 1px solid #fff;
    font-size: 10px;
    width: 150px;
    
    }
    /* style the background and forground colors of the links on hover */
    .menu ul li:hover ul li a:hover {
    background:#007e3e; 
    color:#fff;
    border: 1px solid #fff;
    margin-left: 7px;
    margin-top: 0px;
    margin-bottom: 0px;
    
    }
    
    
    .active {
    font-size: 13.5px;
    background: url(paw_white.png);
    }



    Any ideas?

    Thanks
      • 11055 ☆ A M B ☆
      • 3,112 Posts
      which menu?
      any screenshot?

      have you tried to use kongondo’s tutorial about classes?
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
        • 4429
        • 429 Posts
        Yep i’ve red the ebook.

        its the menu here:
        http://www.naturediet.co.uk/index.php?id=202 - (i don’t want modxcms coming up on analytics)

        wayfinder call:
        [[Wayfinder? &startId=`85` &level=`3` &parentClass=`hide` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`menu` &cssTpl=`cssplay_basicdd`]]


        cssplay_basicdd
        <link rel="stylesheet" media="all" type="text/css" href="assets/templates/wayfinder/basic_dd.css" />
        <!--[if lte IE 6]>
        <link rel="stylesheet" media="all" type="text/css" href="assets/templates/wayfinder/basic_dd_ie.css" />
        <![endif]-->
        <!--[if gte IE 6]>
        <link rel="stylesheet" media="all" type="text/css" href="assets/templates/wayfinder/basic_dd_ie7.css" />
        <![endif]-->
        


        cssplay_inner
        <ul>
            [+wf.wrapper+]
        </ul>
        


        cssplay_outer
        <div[+wf.classes+]>
            <ul>
                [+wf.wrapper+]
            </ul>
        </div>



        cssplay_parentRow
        <li><a  [+wf.classes+] href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>
            <!--[if lte IE 6]>
            <a class="sub" href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]
            <table><tr><td>
            <![endif]-->
            [+wf.wrapper+]
            <!--[if lte IE 6]>
        	</td></tr></table>
            </a>
            <![endif]-->
        </li>


        cssplay_row
        <li[+wf.classes+]><a  href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>


          • 11055 ☆ A M B ☆
          • 3,112 Posts
          so... sorry, what’s the problem again?
          It works from here.
          http://www.naturediet.co.uk/news.html
            Rico
            Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
            MODx is great, but knowing how to use it well makes it perfect!

            www.virtudraft.com

            Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

            Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

            Maintainter/contributor of Babel

            Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
            • 4429
            • 429 Posts
            Quote from: goldsky at Sep 08, 2009, 10:52 AM

            so... sorry, what’s the problem again?
            It works from here.
            www.naturediet.co.uk/news.html

            No that link is a static site that uses a javascript menu not the code or link I supplied above.

            What i am trying to do is recreate that javascript menu into a modx friendly format.
              • 11055 ☆ A M B ☆
              • 3,112 Posts
              Uhm... may be the page 64-65 (&hereTpl and &innerHereTpl template parameters) of kongondo’s e-book is what you’re looking for.
                Rico
                Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                MODx is great, but knowing how to use it well makes it perfect!

                www.virtudraft.com

                Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                Maintainter/contributor of Babel

                Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                • 4429
                • 429 Posts
                Wayfinder is already outputting the correct class i.e "active" the problem is that the .active style in my style sheet is not being put into affect
                  • 12028
                  • 152 Posts
                  Henrik Nielsen Reply #8, 17 years ago
                  In your stylesheet you can add !important to overrule the specificity:

                  .active {
                  background:transparent url(paw_white.png) !important;
                  font-size:13.5px;
                  }



                  There are more info about the specificity topic here: http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/

                    - A small step for mankind, so why not take two...

                    Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
                    • 11055 ☆ A M B ☆
                    • 3,112 Posts
                    1.
                    Kongondo’s tutorial, page 138, Chapter 16: Troubleshooting,

                    20. What is this "active" class being applied to my menu items by default?
                    That is coming from the &hereClass which is applied by default. If you do no want it you can specify &hereClass=`` in your Wayfinder call. You can change the class name if you like by doing this &hereClass=`name_you_want`
                    The same principles can be applied to the other Wayfinder classes where applicable
                    2.
                    Although you can intercept the active class behavior (which comes out from function in wayfinder.inc.php), by making a specify css file, just make sure you put in the RIGHT ORDER of (if there are several) css files call in the html header (eg.: don’t put reset.css of 960.gs file in the last order).
                    3.
                    Anyway, where the "active" classname is being put?
                    Check your snippet script:
                    //get user class definitions
                    $wf->_css = array(
                    	'first' => isset($firstClass) ? $firstClass : '',
                    	'last' => isset($lastClass) ? $lastClass : 'last',
                    	'here' => isset($hereClass) ? $hereClass : 'active', <=== here we go
                    	'parent' => isset($parentClass) ? $parentClass : '',
                    	'row' => isset($rowClass) ? $rowClass : '',
                    	'outer' => isset($outerClass) ? $outerClass : '',
                    	'inner' => isset($innerClass) ? $innerClass : '',
                    	'level' => isset($levelClass) ? $levelClass: '',
                    	'self' => isset($selfClass) ? $selfClass : '',
                    	'weblink' => isset($webLinkClass) ? $webLinkClass : '',
                    );
                    
                      Rico
                      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                      MODx is great, but knowing how to use it well makes it perfect!

                      www.virtudraft.com

                      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                      Maintainter/contributor of Babel

                      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                      • 4429
                      • 429 Posts
                      I don’t really understant that last post.

                      i have added important tags, which works fine in FF and Safari now in IE7.

                      Of course IE6 doesn’t work.

                      My IE6 wayfinder stylesheet for the menu is:

                      TABLE {
                      	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; BORDER-COLLAPSE: collapse
                      }
                      .menu UL LI A.hide {
                      	DISPLAY: none
                      }
                      .menu UL LI A.hide:visited {
                      	DISPLAY: none
                      }
                      .menu UL LI A:hover {
                      	COLOR: #fff;
                      	BACKGROUND: #faeec7; 
                      
                      }
                      .menu UL LI A:hover UL {
                      	DISPLAY: block; LEFT: 0px; WIDTH: 113px; POSITION: absolute; TOP: 32px
                      }
                      .menu UL LI A:hover UL LI A {
                      	BACKGROUND: #faeec7; 
                      	COLOR: #ffffff;
                      }
                      .menu UL LI A:hover UL LI A:hover {
                      	BACKGROUND: #dfc184; 
                      	COLOR: #ffffff;
                      }
                      


                      any time i try to change a color code the dropdowns all of a sudden do not work. its the same if I add a background image too.