I'm trying to animate this 'sliderish' thing that I just made. And since i'm an infant when it comes to jquery i'm having trouble.
I thought this would work but it isn't.
$('ul').animate({.css('left', -600)}, "slow");
but obviously that isn't working
$('#slide-left').click(function(){
$('ul').css('left', 0);
return false;
});
$('#slide-right').click(function(){
$('ul').css('left', -600);
return false;
});
$('#back-right').click(function(){
$('ul').css('left', -300);
return false;
});
$('#back-left').click(function(){
$('ul').css('left', -300);
return false;
});
heres a fiddle http://jsfiddle.net/NePyd/3/
You have the wrong syntax for animate, it's .animate( properties [, duration ] [, easing ] [, complete ] )
:
$('ul').animate({left: -600}, 600);
Check out the docs for a more comprehensive understanding of .animate()
$('ul').animate({'left':0}, "slow");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.