I think you can do this with the jQuery .length() div , which constantly recounts the required width and height depending on the size of the window. Therefore, if ...
div { width: 100px; height: 100px; float: left; }
Then...
$(document).ready(function(){ changeSize(); }); function changeSize(){ var length = $('div').length(); //let say is 12 var windowwidth = $(window).width(); //let say it 1000px, if (length >= 10 && windowwidth >= 600px){ $('section').css('width', '300px'); $('section').css('min-height', '400px'); } else if { //Some more sizing code... } } $(window).resize(function() { changeSize(); });
You will need to set the conditions in the if statements based on your needs, but this method should do this.
source share