Animation Button with Jquery

Jquery Code:
<script type=”text/javascript”>
$(document).ready(function(){
$(”.button”).hover(function(){
$(”.button img”)
.animate({top:”-10px”}, 200).animate({top:”-4px”}, 200) // first jump
.animate({top:”-7px”}, 100).animate({top:”-4px”}, 100) // second jump
.animate({top:”-6px”}, 100).animate({top:”-4px”}, 100); // the last jump
});
});
</script>


CSS Code:

<style type=”text/css”>
body {
font-family: Arial, Helvetica, Sans-Serif;
font-size: 12px;
margin: 20px;
}
.button {
padding: 4px 10px 3px 25px;
border: solid 1px #8AB134;
position: relative;
cursor: pointer;
display: inline-block;
background-image: url( ‘bkg.png’ );
background-repeat: repeat-x;
font-size: 11px;
height: 16px;
text-decoration: none;
color: #40740D;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
.button img {
position: absolute;
top: -4px;
left: -12px;
border: none;
}
.button:hover {
color: #8AB134;
}
</style>


Html code:
<body>
<a class=”button” href=”#”>
<img src=”button.png” alt=”" />Send info</a> or <a href=”#”>cancel</a>
</body>
</html>

Source Code:
<html>
<head>
<title>Animated Jquery</title>
<script type=”text/javascript” src=”jquery-1.2.6.min.js”></script>

<script type=”text/javascript”>
$(document).ready(function(){
$(”.button”).hover(function(){
$(”.button img”)
.animate({top:”-10px”}, 200).animate({top:”-4px”}, 200) // first jump
.animate({top:”-7px”}, 100).animate({top:”-4px”}, 100) // second jump
.animate({top:”-6px”}, 100).animate({top:”-4px”}, 100); // the last jump
});
});
</script>

<style type=”text/css”>
body {
font-family: Arial, Helvetica, Sans-Serif;
font-size: 12px;
margin: 20px;
}
.button {
padding: 4px 10px 3px 25px;
border: solid 1px #8AB134;
position: relative;
cursor: pointer;
display: inline-block;
background-image: url( ‘bkg.png’ );
background-repeat: repeat-x;
font-size: 11px;
height: 16px;
text-decoration: none;
color: #40740D;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
}
.button img {
position: absolute;
top: -4px;
left: -12px;
border: none;
}
.button:hover {
color: #8AB134;
}
</style>

</head>
<body>
<a class=”button” href=”#”>
<img src=”button.png” alt=”" />Send info</a> or <a href=”#”>cancel</a>
</body>
</html>


| More
Thank for reading My post.Feel free for any comments.
ahkeno

This entry was posted on Friday, May 28th, 2010 at 11:25 am and is filed under Information Technology, Jquery. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply