Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Page transitions (fade in/out) with JQuery

Posted on 2008-10-26
3
Medium Priority
?
8,522 Views
Last Modified: 2013-11-11
Hi everyone,

I was wondering if anyone had any good pointers for using JQuery to achieve page transitions (ie: Once page is loaded, page fades in, then on link click the page fades out and fades in the next page).

I have been using scriptaculous to achieve this with some success however I am finding that lots of componants are just flashing in order out so looking to change languages to something with a little bit more "punch" to it.

Any suggestions regardless of scripting language would be greatly appreciated. An example of my current scriptaculous page transition can be seen at www.richardmassey.com.au
0
Comment
Question by:RichardMass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Expert Comment

by:sh0e
ID: 22809978
FYI, EE has a section for jQuery: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/#browseZones
Not to knock Scriptaculous, but I have found jQuery to be more compatible in general.

Here is how to hide, fade in, and fade out.
$(document.body).hide();
$(document.body).fadeIn();

$(document.body).fadeOut();
0
 
LVL 16

Accepted Solution

by:
sh0e earned 2000 total points
ID: 22810014
jQuery has slightly different syntax from Prototype.  But you should be able to pick it up fast.  You might trip over yourself using the wrong syntax a little at first.

I took the liberty of writing a demo for you.
<html>
<head><title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
        jQuery('a').click(function(){
        jQuery(document.body).fadeOut();
        setTimeout("nav('"+this.href+"')",1500);
        return false;
    });
});
 
function nav(href){
 location.href=href;
}
</script>
</head>
<body>
<a href="test.html">test</a>
<a href="http://www.google.com">Google</a>
<a href="http://jquery.com">jQuery</a>
</body>
</html>

Open in new window

0
 
LVL 1

Author Closing Comment

by:RichardMass
ID: 31510159
That's fantastic, thank you so much. I've been able to pick your example apart and work out what does what and it has helped with playing with other functions as well.

Thank you heaps. I'm sure I will have more question on EE regarding JQuery but you have given me a great start.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question