0
我正在尋找一種將特定內容放入Bootstrap模式而不重複代碼的方法。引導模式:構建動態內容
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<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" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<ul>
<li data-toggle="modal" data-target="#myModal" data-content="Content of Text1">Text1</li>
<li data-toggle="modal" data-target="#myModal" data-content="Content of Text2">Text2</li>
<li data-toggle="modal" data-target="#myModal" data-content="Content of Text3">Text3</li>
</ul>
因此,這意味着該模式應該是足夠的智慧理解(文本,文本2或文本3)點擊了哪個項目,並顯示存儲在屬性數據內容的內容。
我該怎麼做?
它會告訴你如何做到這一點的引導文件:http://getbootstrap.com/javascript/#modals-related-target –
有你讀了一節[不同模態內容用觸發器](http://getbootstrap.com/javascript/#modals-related-target)? – manix