[jQuery] I need an opinion
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:
========