Is it possible to animate a DOM Object by a css-property from a variable in jQuery ?
this code does not work, where...
html:
<a data-direction="prev" title="" href="#">prev</a>
<a data-direction="next" title="" href="#">next</a>
javascript:
var _direction = $(this).data('direction'),
_padding = (_direction == 'prev') ? 'margin-left' : 'margin-right'; //set css
$(this).animate({_padding:$(this).width(), opacity: 0},{duration: 320, complete:
function() {
console.log("done!");
$(this).removeAttr('style');
}
});
Does anybody know a work around ?