Jquery simple Slide up and Slide down
Simple Jquery slide up and slide down
Here's the HTML for jquery slide down and slide up.
<ul>
<li><a href="index.php" class="current_link">THE LATEST</a></li>
<li><a href="community.php" >COMMUNITY</a>
<ul>
<li><a href="chat.php" >Video Chat</a></li>
</ul>
</li>
<li><a href="business.php" >BUSINESS</a>
<ul>
<li><a href="market_price.php">Market Rates & Trading</a></li>
</ul>
</li>
<li><a href="entertainment.php" >ENTERTAINMENT</a></li>
<li class = "top_menu"><a href="#" >LIFESTYLE</a>
<ul class = "sub_menu">
<li><a href="top_eats.php">TOP EATS</a></li>
<li><a href="night_life.php">NIGHT LIFE</a></li>
<li><a href="special_events.php"> SPECIAL EVENTS</a></li>
<li><a href="health_and_wellbeing. php">HEALTH & WELL BEING</a></li>
<li><a href="lgbt.php">LGBT</a></li>
</ul>
</li>
<li><a href="sports.php" >SPORTS</a></li>
<li><a href="classified.php" >CLASSIFIED</a></li>
<li class = "top_menu">
<a href="#" style="position:relative;" >VIDEOS</a>
<ul class = "sub_menu">
<li><a href="the_latest.php">Live Shows</a></li>
<li><a href="videos.php">Video Archive</a></li>
</ul>
</li>
</ul>
And the Jquery is
$(".top_menu").children("ul"). hide();
$(".top_menu").hover(function( ) {
$(this).children(".sub_menu"). slideDown(1000);
}, function() {
$(this).children(".sub_menu"). slideUp(1000);
});
CSS is
ul{marign:5px;}
ul li{margin:2px}
ul li ul{margin-left:30px}
.top_menu a{color:#ff0000;font-weight: bold;}
Comments
Post a Comment