Spyrko
Spyrko

Reputation: 27

Trying to understand JSTween basics

I'm sitting here now for about three hours trying to make a simple Animation with JSTween. I found a few threads where I got examples for what I'm trying to do (for Example this) but it just doesn't work. For sure it's just some "when you see it" failure. Would be nice if one of you would have a look on the code.

HTML

<body>
  <ul id="slides">
    <li id="left">
    </li>
    <li id="center">
    </li>
    <li id="right">
    </li>
  </ul>
</body>

JavaScript

$(window).load(function(){
  var left = $('#left'),
      center = $('#center'),
      right = $('#right');


  center.click(function(){  
    left.tween({
      left:{
        start: -500,
        stop: 0,
        time: 0,
        duration: 3,
        units: 'px',
        effect: 'easeInOut' 
      }
    });
  $.play();
  });
});

Thanks Spyrko

Upvotes: 0

Views: 153

Answers (1)

ajtrichards
ajtrichards

Reputation: 30565

Instead of using:

$(window).load(function(){

Use:

$(document).ready(function(){

I amended your JSFiddle and it works fine: http://jsfiddle.net/7t5La/3/

Upvotes: 1

Related Questions