treehouse : what would you like to learn today?
Web Design Web Development iOS Development

JQuery Animation

  • Hi, I would like to recreate the effect you can see here: http://urbanmandesign.com/tests/animate.php using JQuery. I ask because it isn't very easy on the browser using this method and I would like it to be a nice clean movement. I would then like to make it more complex for example adding rotation and I feel this could be better achieved with JQuery. So can this be done, and if so how?

    Thanks

    -Tom
  • Something like this works....


    $(function (){

    $(\"div\").animate({
    bottom: \"0px\",
    right: \"0px\"
    }, 3000 );
    });


    The "bottom" and "right" parameters can be changed to whatever your destination should be.
    The "3000" in the above example is miliseconds, so 3 seconds for it to travel to it's destination...

    The html for this would need a div with position absolute.

    Note, this is in essence, rapidly changing the CSS of the page, so sometimes it looks a littly sluggish/buggy. Also I don;t think rotation is supported, because css doesn't natively support rotation (maybe some css3 stuff does, not too sure)
  • "blue642" said:

    Note, this is in essence, rapidly changing the CSS of the page, so sometimes it looks a littly sluggish/buggy. Also I don;t think rotation is supported, because css doesn't natively support rotation (maybe some css3 stuff does, not too sure)


    yea rotation is beginning to be supported - but yes, IE is probably going to hold back, or rotate in the opposite direction, or maybe just turn your site into a big "lol cat".
  • Thanks for your reply, I am going to use that code, and Rob tbh I stopped caring for IE and yeah, you are most likely right - but who cares?!
  • well unfortunately IE has a huge market share - so you do need to cater for IE users, mainly because most users wont know that the browser they use is a browser, they just think its the internet.

    IE6 can go hang though lol
  • Oh yeah I totally agree, all I'm saying is I kow most of the visitors to my site won't be using IE thereofre I will be focusing more on other, more up to date browsers.

    BTW: The link is now dead