我使用的是materializecss.com框架。我想创建一个模态。我查看了文档(http://materializecss.com/modals.html),如何创建模态。我创建了一个模态,就像它解释的文档......
<!-- Modal Trigger -->
<a class="waves-effect waves-light btn modal-trigger" href="#modal1">Modal</a>
<!-- Modal Structure -->
<div id="modal1" class="modal bottom-sheet">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
但如果我点击按钮,则没有任何反应。
答案 0 :(得分:1)
To open a modal using a trigger you must Initialize the modal;
$(document).ready(function(){
$('.modal-trigger').leanModal();
});