jquery - display: inline-block doesn't work on ajax response -
when receive response script create new elements , attach them main container, these new elements doesn't respect "display: inline-block" property, tried embed style on html doesn't work either.
here's code
jquery.post('includes/script.php', {getmore: true}, function(data) { dato = jquery.parsejson(data); $.each(dato, function(i){ var html = '<div class="container_'+ dato[i][1] +'" data-img="'+dato[i][2]+'" data-order="'+dato[i][3]+'" style="display: inline-block">'+ '<img src="'+dato[i][0]+'" class="img_'+ dato[i][1] +'" />'+ '</div>'; $('div#main-container').append(html); }); });
when element set display inline-block then browser place 'white space' @ right side of element.
when insert kind of elements ajax seems doesn't take place.
i had problem too. i ended adding 'white space' myself. in case should change code like:
var html = ' <div class="container_'+ ....
anyway should insert nbsp; between elements receive through ajax.
Comments
Post a Comment