I like to write a code that will add margin:0 auto; to a div.
var bestsize = 1445;
var width = $('.first-image').width();
if( width >= bestsize){
$('.first-image').css({margin : '0 auto'});
}
else {
$('.first-image').css({margin :' 0 0 -1px 0'});
}
first-image is a div that has a background image
This is what I have, I think it should work. but maybe i am not stating it correctly. currently nothing will happen. I have feeling that I do not use width the proper way. Can someone give me an idea if this solution is no good?
Thank you very much :)
csscalls execute?