<li><a href="[[+wf.link]]" class="[[+wf.description]]" title="[[+wf.title]]">[[+wf.linktext]</a> <div class="sub"> [[+wf.wrapper]]</div></li>
<ul><li><h2><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a></h2></li>[[+wf.wrapper]]</ul>
&innerClass=`sub`
[[!Wayfinder? &startId=`0` &level=`3` &outerTpl=`megaouterTpl` &innerTpl=`megainnerTpl` &categoryFoldersTpl=`megacategoryFoldersTpl` &parentRowTpl=`megaparentRowTpl` &innerRowTpl=`megainnerRowTpl` &rowTpl=`megarowTpl`]]
<li><a href="[[+wf.link]]" class="[[+wf.description]]" title="[[+wf.title]]">[[+wf.linktext]]</a></li>
now the only problem appears to be that everything showing in a list and defaulting to the parents <h2> styling. Trying to figure out how to get the display to show with <li> columns and <h2> headers as in the demo --> http://www.sohtanaka.com/web-design/examples/mega-dropdowns/
Any insight would be great, I am a novice to modx and trying to learn as I go.
EDIT SOLVED: using the [[*description]] tags on the pages from
rowTpl chunk
<li><a href="[[+wf.link]]" class="[[+wf.description]]" title="[[+wf.title]]">[[+wf.linktext]]</a></li>
and styling those classes with css I was able to get it working! the styles have to be applied with the position:absolute attribute to get the columns lining up. I’m sure its a relative mashup and could be done cleaner but it works for now
I hope this helps someone, It just about killed me for a couple days.
<?php $startId = 0; $level = 3; $selfClass = ''; $firstClass = ''; $hereClass = ''; $lastClass = ''; $parentClass =''; $outerTpl = '@CODE: <ul id="topnav"> [+wf.wrapper+] </ul>'; /* This is the one used for the Products items on the demo */ $innerTpl = '@CODE:<div class="sub"> <ul> [+wf.wrapper+] </ul> </div>'; // This is the one used for the Sale items on the demo /* $innerTpl = '@CODE:<div class="sub"> <div class="row"> <ul style="width: 225px;"> [+wf.wrapper+] </ul> </div>'; */ $categoryFoldersTpl = '@CODE:<li><a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>'; $parentRowTpl = '@CODE:<li><h2><a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a></h2></li>[+wf.wrapper+]'; $rowTpl = '@CODE:<li><a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a></li>'; ?>
body { margin: 0; padding: 0; font: normal 10px Verdana, Arial, Helvetica, sans-serif; background: url(body_bg.png) repeat-x; } *{outline: none;} img {border: 0;} .container { width: 960px; padding: 0; margin: 0 auto; } #header { background: url(header.jpg) no-repeat; width: 970px; height: 179px; float: left; } ul#topnav { margin: 0; padding: 0; float:left; width: 100%; list-style: none; font-size: 1.1em; } ul#topnav li { float: left; margin: 0; padding: 0; position: relative; } ul#topnav li a { float: left; text-indent: -9999px; height: 44px; } ul#topnav li:hover a, ul#topnav li a:hover { background-position: left bottom; } ul#topnav a.home { background: url(nav_home.png) no-repeat; width: 78px; } ul#topnav a.products { background: url(nav_products.png) no-repeat; width: 117px; } ul#topnav a.sale { background: url(nav_sale.png) no-repeat; width: 124px; } ul#topnav a.community { background: url(nav_community.png) no-repeat; width: 124px; } ul#topnav a.store { background: url(nav_store.png) no-repeat; width: 141px; } ul#topnav li .sub { position: absolute; top: 44px; left: 0; background: #344c00 url(sub_bg.png) repeat-x; padding: 20px 20px 20px; float: left; /*--Bottom right rounded corner--*/ -moz-border-radius-bottomright: 5px; -khtml-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; /*--Bottom left rounded corner--*/ -moz-border-radius-bottomleft: 5px; -khtml-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; display: none; } ul#topnav li .row {clear: both; float: left; width: 100%; margin-bottom: 10px;} ul#topnav li .sub ul{ list-style: none; margin: 0; padding: 0; width: 150px; float: left; } ul#topnav .sub ul li { width: 100%; color: #fff; } ul#topnav .sub ul li h2 { padding: 0; margin: 0; font-size: 1.3em; font-weight: normal; } ul#topnav .sub ul li h2 a { padding: 5px 0; background-image: none; color: #e8e000; } ul#topnav .sub ul li a { float: none; text-indent: 0; /*--Reset text indent--*/ height: auto; background: url(navlist_arrow.png) no-repeat 5px 12px; padding: 7px 5px 7px 15px; display: block; text-decoration: none; color: #fff; } ul#topnav .sub ul li a:hover {color: #ddd; background-position: 5px 12px ;}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <base href="[(site_url)]"></base> <link href="assets/templates/css/mega.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>[*pagetitle*]</title> </head> <body id="home"> <div class="container"> <div id="header"></div> [!Wayfinder? &config=`mega_menu`!] <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript" src="jquery.hoverIntent.minified.js"></script> <script type="text/javascript"> $(document).ready(function() { function megaHoverOver(){ $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Calculate width of all ul's (function($) { jQuery.fn.calcSubWidth = function() { rowWidth = 0; //Calculate row $(this).find("ul").each(function() { rowWidth += $(this).width(); }); }; })(jQuery); if ( $(this).find(".row").length > 0 ) { //If row exists... var biggestRow = 0; //Calculate each row $(this).find(".row").each(function() { $(this).calcSubWidth(); //Find biggest row if(rowWidth > biggestRow) { biggestRow = rowWidth; } }); //Set width $(this).find(".sub").css({'width' :biggestRow}); $(this).find(".row:last").css({'margin':'0'}); } else { //If row does not exist... $(this).calcSubWidth(); //Set Width $(this).find(".sub").css({'width' : rowWidth}); } } function megaHoverOut(){ $(this).find(".sub").stop().fadeTo('fast', 0, function() { $(this).hide(); }); } var config = { sensitivity: 2, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number = milliseconds for onMouseOver polling interval over: megaHoverOver, // function = onMouseOver callback (REQUIRED) timeout: 500, // number = milliseconds delay before onMouseOut out: megaHoverOut // function = onMouseOut callback (REQUIRED) }; $("ul#topnav li .sub").css({'opacity':'0'}); $("ul#topnav li").hoverIntent(config); }); </script> </body> </html>
<ul><li[[+wf.id]]><a href="[[+wf.link]]" class="[[+wf.description]]" title="[[+wf.title]]">[[+page-thumb:notempty=`<img src="[[+page-thumb:phpthumbof=`w=160&h=120&zc=1`]]" alt="[[+pagetitle]]"/>`]][[+wf.linktext]]</a></li></ul>