I don't see anything wrong with this code, but it's not working as expected.
function slide(slideIndex, slideDirection) {
console.log(slideDirection); // outputs 'right'
$('.slide').animate({slideDirection: '-=940'}, 400);
}
$(function(){
$('.prev','.slide').click(function (e) {
e.preventDefault();
var slideIndex = $(this).closest('.slide').index(),
slideDirection = 'right';
slide(slideIndex, slideDirection);
});
});
If I use just the string 'right' in the animate method, it works. What am I doing wrong?