Fade an Entire Design Using jQuery

Published Saturday, February 17, 2007 in CSS, Javascript, jQuery

I've been using jQuery lately at work to create some pretty cool effects and tabs, and I must say I'm starting to like it more and more.

I had an idea to morph a website's design from one to another, so i created this little test (Click anywhere on the page to fade to the other design).
It didn't turn out exactly as cool as I first had hoped, because all I really do is fade out body, change its class and fade it back in.
You could however potentially animate every CSS attribute that differs in the two design, and create a really fuckin neat morph.
I could not be arsed though, cus that would mean putting all the CSS in the js-file.

Also the fade is a bit sketchy. I don't understand why the "Round" design jumps up and down like that, but i guess it's something i have to live with.

I can't use this on my style-switcher though, because changing a style on my site not only changes CSS attributes, but includes other JS-files etc.
And also i can't be arsed to go through every design i've made and put a body.design-n in front of every selector.

Anyhoo, check it out.

Edit: i just realized that instead of changing the class of the body (and having to use body.design-n in the CSS) one could simply change the href attribute of the link element with media "screen".
I can't be bothered to change the example though.


Rate It


Bookmark It

  • del.icio.us
  • Digg
  • Furl
  • Google
  • Technorati
  • Ma.gnolia
  • BlinkList
  • Blogmarks
  • Rojo
  • StumbleUpon

Comments

8 comments so far, why don't you post one too?

Andrew

Monday, February 19, 2007 | View all comments by Andrew

Coolt man, coolt!

jaysus

Friday, November 02, 2007 | View all comments by jaysus

This is soooooo fresh! And your code is cleaner than a monk's bathroom!

Andreas

Saturday, November 03, 2007

Hehe, cheers! I always strive to keep my HTML as clean as possible.

Justin

Tuesday, December 18, 2007 | View all comments by Justin

I was wondering if you could pint me to somewhere I could do a similar trick to this. I want to fade out and then back in just a single div with new information without flash.

~ J.

Andreas

Tuesday, December 18, 2007 | View all comments by Andreas

Check out jquery.com's tutorial section. You can learn loads there.

To do what you want (if I understand you correctly), you'd do something like this:

$('body').fadeOut(500, function() {
    $(this).html(newContent).fadeIn(500);
});

Where newContent is a variable containing the new HTML.

Big balloon guy

Sunday, March 16, 2008 | View all comments by Big balloon guy

I kinda like it, try to use it on bubblexl, let you know!

Magicien

Tuesday, November 11, 2008 | View all comments by Magicien

I've been using jQuery lately at work , it's superb :-)

Guignol

Tuesday, December 30, 2008 | View all comments by Guignol

Ok, thank for your comment and happy new year 2009


Comments closed

Comments are closed



Post It

From June 02 to April 23

  1. Mogrify is what you're looking for if you want to convert multiple images to multiple other images in ImageMagick
  2. Tommorrow, finally, the inFamous demo will be friggin availble on PSN!! Suweeeeeeeeet
  3. Fuck canvas is cool, I've started playing around with old 3D-shit again :)

May 2012

S M T W T F S
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31


Recent Comments

  1. quick quid on Bye, bye exscale!:
    jhtmpl...
  2. cheap viagra on Bye, bye exscale!:
    nsikku...
  3. payday loans on Bye, bye exscale!:
    ixrhvy...
  4. buy cialis on Bye, bye exscale!:
    lqlokhr...

Style Switcher

The style switcher allows you to change the look and feel of exscale.se.
Only CSS and JavaScript are changed. The XHTML stays the same.

For more information about the styles, check the styles page.


Categories


Random Quote

Man måste ändå följa mandarinen, men man måste oxå försöka styra den - Ante


Random Images




Answer This!

Do you find the "scroll-pagination" annoying? (If you don't know what it is, scroll to the bottom of the first-page)


Blog Roll