Home | Projects | Tutorials | Articles | live chat | Submit Project | Big Vote
 
Ajax Projects
.NET Frameworks
Java Frameworks
PHP Frameworks
Ruby Frameworks
Other Frameworks
Cool AJAX sites
Ajax Resources
Ajax Tools
JavaScript frameworks

 Home /  Tutorials / How to Make Slick Page Transitions

How to Make Slick Page Transitions





Here you can know how to add the final touches of sites, To begin, let’s dive straight into the CSS. We’ll need to change the CSS for the and set it to display: none.

Read The Full Tutorial.
































Here you can know how to add the final touches of sites, To begin, let’s dive straight into the CSS. We’ll need to change the CSS for the and set it to display: none.

body { display: none; }

Therefore, a better solution will be adding the display:none CSS property using jQuery. If visitors have JavaScript disabled, they will still be able to see the body content.

<script type="text/javascript">
$(document).ready(function() {
$("body").css("display", "none");
});</script>

here we need to write the jQuery code that creates the fade transition:

<script type="text/javascript">
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn(2000);
});
</script>

Now, if we fire up our browser we can see the new transition in action! But if we click on any of the links, our site disappears like normal.

First, let’s apply a special class on the links we wish to create a fade out effect.

<a href="otherPage.html" class="transition">LINK</a>

Now, if we go back to our HTML, we can modify our script to get some great looking jQuery fades.

<script type="text/javascript">
$(document).ready(function() {
$("body").css("display", "none");

$("body").fadeIn(2000);

$("a.transition").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(1000, redirectPage);
});

function redirectPage() {
window.location = linkLocation;
}
});
</script>

These page fades will look much better if you set a specified background color for the html tag similar to the color of your site’s background color in your CSS. This means when the body fades in and out, there is still a color similar to the existing background you have.

html {
/*If you had a black or close to black background*/
background-color: #000000;
}

AddThis Social Bookmark Button
Top Projects
MSN Web Messenger
MessengerFX
ebuddy
e-messenger
ILoveIM
You Tube
AJAX file upload
KoolIM.com
Meebo
Ajax.NET Professional
Tutorials
jQuery - PHP & Ajax with the Twitter API
Ajax Generic Comments Module
Isomorphic SmartClient: Now Open Source
Flyout Menu Tutorials
Fun with SVG and CSS Animations
Use jQuery to simplify Ajax development
Calling Web Service Methods Using ASP.NET AJAX
AJAX for ASP.NET
How to display Google’s search results in your Web site with PHP
Alter data with Ajax forms