Ads

July 30, 2014

How to Implement an Animation Effect Website with jQuery

How to Implement an Animation Effect Website with jQuery


In this post I want to explain how to implement an Animation Website with jQuery. It's simple just using some lines of java-script code. Implement this and enrich animation features to your web projects. Take a look at the live demo here.
How to Implement an Animation Effect Website with jQuery

Download Script     Live Preview

Javascript Code

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js
"></script>
<script type="text/javascript">
$(document).ready(function() {
$("a.link").LinkAnimate()
});

jQuery.fn.LinkAnimate = function(settings) {

settings = jQuery.extend({
speed : 1000
}, settings);

return this.each(function(){
var boxcall =$(this);
$(boxcall).click(function (event) {
event.preventDefault()
var locationHref = window.location.href
var elementClick = $(boxcall).attr("href")

var destination = $(elementClick).offset().top;
$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
window.location.hash = elementClick
});
return false;
})
})
}
</script>




HTML Code
Contains HTML code. class='link' calling LinkAnimate() function.
<div id='main'>

<div id='menu'>
<a href="#about" class="link"> About</a>
<a href="#profile" class="link">Profile</a>
<a href="#contact" class="link">Contact</a>
</div>

<div id='box'>
<a id="about" ></a>
<h1>About</h1>
</div>

<div id='box'>
<a id="profile"></a>
<h1>Profile</h1>
</div>

<div id='box'>
<a id="contact"></a>
<h1>Contact</h1>
</div>

</div>

CSS Code
body
{
font-family:Arial, Helvetica, sans-serif;
}
a
{
font-weight:bold;
color:#000;
text-decoration:none;
margin-right:50px;
}
a:hover
{
font-weight:bold;
color:#000;
text-decoration:none
}
#main
{
margin-left:70px;
margin-right:70px;
margin-top:70px
}
#menu
{
margin-top:30px;
position:fixed;
margin-left:450px;
font-size:18px;
}
#box
{
height:700px;
}

8 comments:

Anonymous said...

I'm trulpy enjoying the design and layout of your
blog. It's a very eawy onn thee eyes which makes iit much more pleasantt for me to comne here and visit more often. Did you hire out a designer
to create your theme? Fantastic work!

Anonymous said...

I visited multiple sites exxcept the audio quality for audio songs
present aat this web site is truly excellent.

Anonymous said...

My brother suggested I would possibly like this web site. He used to bbe entfirely right.
This post truly made my day. Yoou cann't consider just how sso much tike I had spent
foor this info! Thanks!

Anonymous said...

Why users still use to red news papers whrn in this technological
glpbe the whole thing is available on net?

Anonymous said...

I have been browsing on-line more than three hours nowadays, yett I never discovered any attention-grabbing article like yours.
It's beautiful value enough for me. In my view, if all web owners
and bloggers made good content as you did, the wweb will probably be much more useful than ever before.

Anonymous said...

Hey there just wanted tto give you a quick heads up. The text in your post seem to be running off the screen in Internet explorer.
I'm not sre if this iss a format issue or something to
do with nternet browser compstibility bbut I thought I'd
post to leet you know. The design and style look gredat
though! Hope you get the issue solved soon. Kudos

Anonymous said...

Great items from you, man. I've remember your stuff
previous to and you are simply too fantastic.
I actually like what you have got here, certainly like what you are stating and the way in which by which you are saying it.
You make it entertaining and you continue to care for to stay it sensible.
I can't wait to read far more from you. This is actually a terrific site.

Anonymous said...

Woah! I'm really digging the template/theme of this website.
It's simple, yet effective. A lot of times it's tough to get that "perfect balance" between usability and appearance.

I must say you've done a superb job with this. Additionally, the
blog loads very fast for me on Chrome. Exceptional Blog!

Most Popular Posts