javascript - Creating A Dropline Style Menu -
i trying create dropline style menu.
please see fiddle here - http://jsfiddle.net/oampz/38c6q/
the issue i'm having is, don't want brown menu - or drop down/fade in.. i'm trying sub menu items appear in grey coloured sub div.
$('#main-nav > li').hover(function(){ if(!$(this).find('.main-link').hasclass('active')){ $("#main-nav > li a.active").removeclass("active"); $(this).find('.main-link').addclass("active"); if($(this).find('li').length){ //$("#main-nav li a.close").stop().fadein(); //there no .close var = this; $("#sub-link-bar").stop().animate({ height: "40px"}, function(){ $(that).find(".sub-links").show(); }); } else { $(this).find(".sub-links").stop().fadeout( function(){ $(this).css('opacity','1'); $("#sub-link-bar").stop().animate({height: "1px"}); }); } } }, function(){ if($(this).find('li').length){ $(this).find(".sub-links").stop().hide( function(){ $(this).css('opacity','1'); }); } $("#sub-link-bar").stop().animate({height: "1px"}); $(this).find('.main-link').removeclass('active'); }); any appreciated.
i've updated code http://jsfiddle.net/38c6q/1/
replaced this
$("#sub-link-bar").stop().animate({ height: "40px"}, function(){ $(that).find(".sub-links").show(); }); with
$('#sub-menu').html( $(that).find(".sub-links").html() ) to have them float next each other, can add css
.sub-menu li{ display:block; padding:0; margin:0; float:left; } and add colors , backgrounds links, add css
.sub-menu a{ display:block; margin:0 5px; padding:5px; text-decoration:none; color:#333; } .sub-menu a:hover{ background:#333; color:#fff; } updated demo at http://jsfiddle.net/38c6q/4/
Comments
Post a Comment