We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4310
    • 2,310 Posts
    A couple of typos and a poiner wink
    categoryFoldersTpl=
    <li><a href="[[+wf.link]]" class="[[+wf.description]]" title="[[+wf.title]]">[[+wf.linktext]</a> <div class="sub"> [[+wf.wrapper]]</div></li>

    parentRowTpl=
    <ul><li><h2><a href="[[+wf.link]]" title="[[+wf.title]]">[[+wf.linktext]]</a></h2></li>[[+wf.wrapper]]</ul>

    You shouldn’t need a call to the mega-menu.min.js if you’re using the inline JS
    Shouldn’t think it will fix it, but I’ve sent you an email asking for a login to look a little deeper
      • 24150
      • 4 Posts
      Thanks for the advice. I removed the redundant javascript. In my actual code the typos in the above aren’t there. I have managed to progress a bit with the addition of a wayfinder call to include:
      &innerClass=`sub`
      and its starting to look better.

      EDIT: I removed the link attributes of the sub folders... they were set to : rel="category" as with the top level parents.

      The wayfinder call is now:

      [[!Wayfinder? &startId=`0` &level=`3` &outerTpl=`megaouterTpl` &innerTpl=`megainnerTpl` &categoryFoldersTpl=`megacategoryFoldersTpl` &parentRowTpl=`megaparentRowTpl` &innerRowTpl=`megainnerRowTpl` &rowTpl=`megarowTpl`]]
      ^^ thanks Bunk!

      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 smiley

      I hope this helps someone, It just about killed me for a couple days.
        • 17413
        • 0 Posts
        Hello @ all,

        I try to build a Mega Drop Down navigation under Revolution and I don’t arrive.
        I used code posted by qidoc (all chunks and snippet call) and I don’t have the same result.
        Nothing is written on my page.

        Please qidoc if you read my post, could you help me ?

        Thanks.
        • Did you install Wayfinder? It’s not included by default, but you’ll need to fetch it through the Package Manager (under the System menu, using the "Download Extras" button on the screen you end up at).
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 17413
            • 0 Posts
            Yes of course I installed it after Revolution installation grin

            Without using Wayfinder the MegaDropDown is OK but I had to write in hard in template my navigation architecture.

            My problem today is to use Wayfinder to generate the good syntax between <ul> <li> and different rows and levels...
            • That’s what you can use &rowTpl and the likes for smiley
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 35516
                • 9 Posts
                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 smiley

                I hope this helps someone, It just about killed me for a couple days.



                @qidoc: Just remove H2 tags from megainnerRowTpl and everything should be fine.. smiley
                  • 30672
                  • 180 Posts
                  hi everybody!

                  i’m working with evo 1.0.5 and i try for 2 days making megamenu working, without success....
                  can someone put a whole working solution or explain me what is wrong? i tried everything but it doesn’t work...

                  thank you!

                  here is my code :

                  1. i have make the correction in wayfinder.inc.php
                  2. in the file mega_menu.config.php i have this :

                  <?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>';
                  	
                  ?>


                  3. file mega.css :

                  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 ;}


                  4. modele in modx:

                  <!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>



                  thanks a lot !
                    • 4310
                    • 2,310 Posts
                    Do you have a link?
                    What does your document tree look like?
                      • 35516
                      • 9 Posts
                      Unfortunately I can’t help with Evo, but it works as expected in Revo with afore mentioned code.

                      In addition, if you want to include images in dropdown menu links (e.g. some sort of page thumbnails) it’s pritty easy:


                      Create "page-thumb" TV with Input type: image & Output: text, upload images for a few pages, and change megainnerRowTpl code to something like this (phpthumbof should be preinstalled):

                      <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>
                      


                      (This also assumes &rowIdPrefix is included in wayfinder call and adds [[+wf.id]] for easier styling of individual elements).