Menu Animation in Asp.net Using Jquery
Following
article is showing about menu designing using JQuery in Asp.net:
Step 1:
Create a Website->Add new Item->J query
menu .aspx
Step 2:
Copy the following code and paste it in your .aspx
Design page
J query menu.aspx
<!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 runat="server">
<title></title>
<style type="text/css">
li
{
border:1px solid black;
padding:20px 20px 20px 20px;
width:110px;
background-color: Maroon;
color:White;
cursor:pointer;
}
a { color:White; font-family:Tahoma; }
</style>
<script type ="text/javascript" src="js/jquery-1.4.4.min.js">
</script>
<script type="text/javascript">
$(function () {
$("ul.level1
li").hover(function () {
$(this).stop().animate({
opacity: 0.7, width: "170px" }, "slow");
}, function () {
$(this).stop().animate({
opacity: 1, width: "110px" }, "slow");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id ="menu">
<asp:Menu ID="Menu2" runat="server"
Orientation="Horizontal"
RenderingMode="List">
<Items>
<asp:MenuItem NavigateUrl="" ImageUrl="" Text="Home" Value="Home"
/>
<asp:MenuItem NavigateUrl="" ImageUrl="" Text="About Us" Value="AboutUs" />
<asp:MenuItem NavigateUrl="" ImageUrl="" Text="Products" Value="Products" />
<asp:MenuItem NavigateUrl="" ImageUrl="" Text="Contact Us" Value="ContactUs" />
</Items>
</asp:Menu>
</div>
</form>
</body>
</html>
The run the application and watch the output
Note:* One
thing you should remember that, if you use j Query related coding in your web
page then you must add j Query.js file must be included in that page.
Demo:
No comments:
Post a Comment