troubleshooting Question

Make default dropped down - menu

Avatar of movieprodw
movieprodw asked on
JavaScript
8 Comments1 Solution378 ViewsLast Modified:
Hello,

I have the below code for my nav menus and I was wondering if I could make on of the drop downs, down, by default.

I would like nav-1 dropped down until nav-3 is hovered over.

Thanks!

<script type="text/javascript">
	var $j = jQuery.noConflict();
	
     jQuery(document).ready(function($){
		 var config = {    
			 over: showSub, // function = onMouseOver callback (REQUIRED)    
			 timeout: 500, // number = milliseconds delay before onMouseOut    
			 out: hideSub // function = onMouseOut callback (REQUIRED)    
		};
		
		buildSub('.nav-1', 0);
		buildSub('.nav-3', -138);
		
		$('#nav li .sub .nav ul').show();
		
		
		//$j(".nav-2 .sub").show(); 
		
		$('#nav li').hoverIntent(config);
     });
		function buildSub(name, offset) {
			var list = $j(name).find("ul").text();
			if (list.length > 0) {
				list = '<div class="nav"><ul>' + $j(name).find("ul").html() + '</ul></div>';
			} else {
				list = '';
			}
			
			var content = $j('.na-' + name.substring(1) ).html();
			var sub = '<div id="nav-1" class="sub">' + list + '</div>';
			$j(name).append(sub);
			$j(name + ' .sub').attr('id', name.substring(1));
			$j(name + ' .sub').css('left', offset + 'px');
		}
		function showSub(){ 
			$j(this).find(".sub").slideDown(); 
		}
		function hideSub(){ $j(this).find(".sub").slideUp(); }
</script>
<script type="text/javascript">
function clearText(field){
 
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
 
}
</script>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros