我想在每行放置3个缩略图,我正在使用“col-md-4”。但是如果有4个以上的缩略图,则会创建一个新行,并且该新行中将有3个缩略图。我该怎么做?
FB.api('/me/albums?fields=picture', 'get', {
access_token: userToken
}, function(response) {
var data = response.data;
for (var i = 0, l = response.data.length; i < l; i++) {
var pictureUrl = data[i].picture.data.url;
$("#albumPicturesModalBody").append("<div class=\"col-md-4\"><a class=\"thumbnail albumPicture\"><img src=\"" + pictureUrl + "\" alt=\"...\" class=\"img-rounded\"></a></div>");
}
});
<div class="modal" id="albumPicturesModal" style="padding-top: 70px;" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Select An Album</h4>
</div>
<div class="modal-body" style="max-height: 400px; min-height: 400px; overflow-y: scroll;">
<div class="row" id="albumPicturesModalBody">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
这是对你的另一个问题的回应:“如何根据图像数量计算引导行数”
function howManyRows(totalImages) {
var count = Math.round(totalImages / 3);
return count;
}
console.log(howManyRows(50)); // output: 17
您可以使用类似的东西来确定在此处为其他功能请求创建的行数。