Possiamo usare jQuery per applicare il clear alle colonne CSS.
Definiamo la seguente classe CSS:
.clear {
clear: both;
}
E il seguente codice jQuery:
$.fn.clearAfter = function( index ) {
return this.each(function() {
var $element = $( this );
var elIndex = $element.index() + 1;
if( elIndex % index == 0 ) {
$element.after( "<div class='clear'></div>" );
}
});
};
$(function() {
$( ".col" ).clearAfter( 3 ); // 3 colonne
});