I have a jQuery code: $(document).ready(function() { var xPos = 200; var yPos = 50; var links = $('.buttons a');
links.each(function() { var index = links.index(this); if ($(this).hasClass('active')) { $(this).css('backgroundPosition', -index * xPos + 'px ' + -yPos + 'px'); } else { $(this).css('backgroundPosition', '-' + index * xPos + 'px ' + '-0px'); } }); Which is the best way to use: This code: ======== >> $(this).css('backgroundPosition', -index * xPos + 'px ' + -yPos + 'px'); or this code: ========= >> $(this).css('backgroundPosition', '-' + index * xPos + 'px -' + yPos + 'px'); I think, each line do the same thing.. But the first line is shorter because I use -index, instead of '-' + index. Thanks!