So far i have the code below:
$('.pagination').each(function(){
var paginationWidth = $(this).width();
var pixelOffset = '-' + paginationWidth + 'px';
console.log(paginationWidth.css('margin-left', pixelOffset ));
});
Console log shows "Object 57 has no method 'css'", the number being the width. Why is this the case on an each element? If its not an array why can't .css() be called upon each of said elements?
var paginationWidth = $(this).width();which is not a jquery object (just a number). Try$(this).css('margin-left', pixelOffset )