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

Jerky Animation

  • Hi All

    This is my first attempt at using JQuery (thanks Chris for the tutorials that helped).

    Everything that I have done seems to work but sometimes the animated image is very jerky; even when viewing it from local files. Is bad coding or the image size causing it?

    Here is my test page
    http://iandelemare.justfree.com/helinor/demo.html

    Any suggestions/help would be very useful.

    Thanks in advance
    Regards

    Athelstan
  • try putting the animation inside:


    $(window).load(function() {

    // your animation

    });



    It might work better after the window has fully loaded everything, otherwise the browser is fighting for resources - and jquery(javascript) is all handled locally...
  • Thank you Robskiwarrior for your input. I have tried your suggestion but it hasn't made any difference. I hope Iadded the window.load in the correct place!

    The updated file (flyby.js) is now on the test site

    Regards
  • You put it in the perfect place.

    I would say then it's just down to speed of computer. On this PC it's hardly jerky at all, in FF and Chrome it runs really smooth - this PC is pretty old now (about 4 years) and wasn't too hot when it was put together... (father inlaws PC lol)

    One of the issues with javascript is that it is very user dependant - as it depends on system resources to load the animation. This is getting less as people's machines get better and browsers get more efficient at handling JS.

    So for me - it's running smooth. :) It might just be one of those "things"