Создание анимации на самом деле довольно просто.Установите интервал для изменения свойств CSS элемента и позвольте вашей функции работать рекурсивно:
var distance = 300,
frames = 30,
current_frame = 0,
time = 1000,
delta = Math.floor(distance / frames),
$element = $('#my-element'),
my_timer;
my_timer = setInterval(function () {
//make sure the end of the animation has not been reached
if (current_frame < frames) {
//get the current property you want to animate and add to it the `delta` variable which is how much the property should change in each iteration
var left = parseInt($element.css('left').replace('px', ''), 10);
$element.css('left', (left + delta));
} else {
//the end of the animation has been reached so stop the interval
clearInterval(my_timer);
}
current_frame++;
}, Math.floor(time / frames));
Вот пример: http://jsfiddle.net/aDLbK/1/
Конечно, это все еще использует функцию .css()
jQueryно вы можете удалить эту единственную строку и поместить в любой JavaScript-код, которым хотите манипулировать элементом.