1
<div class="modal fade" id="emojimodal" tabindex="-1" role="dialog" aria-labelledby="emojilabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" id="bgcolorheader">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title" id="myModalLabel">Select emoji</h3>
</div>
<!-- to be dynamically populated from js -->
<div class="modal-body" id="modalDiv"> </div>
</div>
</div>
</div>
我需要在行和引导网格的列在模式中添加图像。我需要动态使用jQuery来做到这一点。我先用行开始,然后我需要为每个列扩展相同的逻辑。以下功能仅显示第一张图像。我如何让图像显示在多行中?
function createGrid(rownum, imagearraySrc) {
for (var rowIndex = 0; rowIndex < rownum; rowIndex++) {
var rowid = "row" + rowIndex;
var $row = $("<div>", {
"class": "row",
"id": rowid
});
$('#modalDiv').append($row);
var imgid = "img" + rowIndex;
var $img = $("<img>", {
"id": imgid,
"src": imagearraySrc[rowIndex],
});
$($row[rowIndex]).append($img);
}
};
的ROWNUM值获取传递给函数为2 imagearraySrc包含所有图像的SRC。目标是拥有x行和y列,并在每个列中都有图像。所有这些都会以模式显示,用户将选择其中一个。附加的代码是一个起点,并没有帮助我前进。有人可以帮忙吗?
请分享你的'HTML'代码以及 – Shiladitya
共享的HTML也是如此。 – newstudent