Tuesday, 6 August 2013

Pass jQuery parameter with different name

Pass jQuery parameter with different name

I want to choose the css settings based on the existance of a data tag.
Which is the right way to do it?
var datadirection = 'left'; //default direction
if( $(this).attr('data-right') ){
datadirection = 'right';
}
$(this).css({
datadirection : fxpositionX + 'px'
}).transition({
datadirection : '0px'
});
Thank you in advance for your help!

No comments:

Post a Comment