Step 9: In this step you will see the body code of the Default2.aspx page which is given below.
Code:
<body>
<div class="menu">
<div class="item">
<a class="link icon_mail"></a>
<div class="item_content">
<h2>
Contact us</h2>
<p>
<a href="#">Mahesh Chand</a> <a href="#">Akshay Teotia</a>
</p>
</div>
</div>
<div class="item">
<a class="link icon_help"></a>
<div class="item_content">
<h2>
Consulting</h2>
<p>
<a href="http://www.c-sharpcorner.com/Consulting/">Why Us</a>
</p>
</div>
</div>
<div class="item">
<a class="link icon_find"></a>
<div class="item_content">
<h2>
Search</h2>
<p>
<input type="text"></input>
<a href="">Go</a>
</p>
</div>
</div>
<div class="item">
<a class="link icon_home"></a>
<div class="item_content">
<h2>
C# Corner Home
</h2>
<p>
<a href="http://www.tympanus.net/">Start</a>
</p>
</div>
</div>
</div>
<script type="text/javascript">
$('.item').hover(
function () {
var $this = $(this);
expand($this);
},
function () {
var $this = $(this);
collapse($this);
}
);
function expand($elem) {
var angle = 0;
var t = setInterval(function () {
if (angle == 1440) {
clearInterval(t);
return;
}
angle += 40;
$('.link', $elem).stop().animate({ rotate: '+=-40deg' }, 0);
}, 10);
$elem.stop().animate({ width: '268px' }, 1000)
.find('.item_content').fadeIn(400, function () {
$(this).find('p').stop(true, true).fadeIn(600);
});
}
function collapse($elem) {
var angle = 1440;
var t = setInterval(function () {
if (angle == 0) {
clearInterval(t);
return;
}
angle -= 40;
$('.link', $elem).stop().animate({ rotate: '+=40deg' }, 0);
}, 10);
$elem.stop().animate({ width: '52px' }, 1000)
.find('.item_content').stop(true, true).fadeOut().find('p').stop(true, true).fadeOut();
}
</script>
</body>
Step 10: In this step we will see the complete code of the Default2.aspx page which is given below.
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="RoundedMenu.Default2" %>
<!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>Rounded Menu Using jQuery</title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-animate-css-rotate-scale.js" type="text/javascript"></script>
<script src="Scripts/jquery-css-transform.js" type="text/javascript"></script>
<link href="Styles/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
*
{
margin: 0;
padding: 0;
background: #BF3EFF;
}
.title
{
width: 703px;
height: 144px;
position: absolute;
top: 0px;
left: 0px;
background: #BF3EFF;
}
a.back
{
background: #BF3EFF;
position: fixed;
width: 150px;
height: 27px;
outline: none;
bottom: 0px;
left: 0px;
}
</style>
</head>
<body>
<div class="menu">
<div class="item">
<a class="link icon_mail"></a>
<div class="item_content">
<h2>
Contact us</h2>
<p>
<a href="#">Mahesh Chand</a> <a href="#">Akshay Teotia</a>
</p>
</div>
</div>
<div class="item">
<a class="link icon_help"></a>
<div class="item_content">
<h2>
Consulting</h2>
<p>
<a href="http://www.c-sharpcorner.com/Consulting/">Why Us</a>
</p>
</div>
</div>
<div class="item">
<a class="link icon_find"></a>
<div class="item_content">
<h2>
Search</h2>
<p>
<input type="text"></input>
<a href="">Go</a>
</p>
</div>
</div>
<div class="item">
<a class="link icon_home"></a>
<div class="item_content">
<h2>
C# Corner Home
</h2>
<p>
<a href="http://www.tympanus.net/">Start</a>
</p>
</div>
</div>
</div>
<script type="text/javascript">
$('.item').hover(
function () {
var $this = $(this);
expand($this);
},
function () {
var $this = $(this);
collapse($this);
}
);
function expand($elem) {
var angle = 0;
var t = setInterval(function () {
if (angle == 1440) {
clearInterval(t);
return;
}
angle += 40;
$('.link', $elem).stop().animate({ rotate: '+=-40deg' }, 0);
}, 10);
$elem.stop().animate({ width: '268px' }, 1000)
.find('.item_content').fadeIn(400, function () {
$(this).find('p').stop(true, true).fadeIn(600);
});
}
function collapse($elem) {
var angle = 1440;
var t = setInterval(function () {
if (angle == 0) {
clearInterval(t);
return;
}
angle -= 40;
$('.link', $elem).stop().animate({ rotate: '+=40deg' }, 0);
}, 10);
$elem.stop().animate({ width: '52px' }, 1000)
.find('.item_content').stop(true, true).fadeOut().find('p').stop(true, true).fadeOut();
}
</script>
</body>
</html>
Step 11: In this step we will see the design of the Default2.aspx page which is given below.
Step 12: In this step we are going to run the Default2.aspx page by pressing F5.
Now to see the rounding and expanding effect, click on the small icon.
Resources