I'm trying to dynamically calculate the min-width of body based on the number of div.columns that exist on the page, plus a padding of 180px. This is the code I'm using:
function countColumns() {
var columns = $('.column').size();
document.write(columns)
}
$('body').css('min-width', (parseInt(columns) * 120) + 180 + 'px') );
Any clue as to why its not working?
columnsis local tocountColumns(), so you cannot access it from the outside. Also, your call toparseInt()looks unnecessary sincesize()already returns anint(and you should uselengthinstead, btw).countColumns()