【发布时间】:2017-06-17 09:50:27
【问题描述】:
我为物化模态写了一个简单的代码。
HTML代码:
<a class="waves-effect waves-light btn view" data-target="modal1">View Scores</a>
<!-- Modal Structure -->
<div id="modal1" class="modal">
<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>
JS代码:
$(document).ready(function() {
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
/*$('.view').click(function (){
$('#modal1').modal('open');
alert('edskjcxnm');
});*/
/*$('.view').leanModal();*/
$('#modal1').modal('open');
});
JSFiddle 链接:https://jsfiddle.net/7f6hmgcf/
为什么它不起作用?
【问题讨论】:
-
它在我的情况下不起作用
-
您能解释一下您遇到了哪些错误以及您为确定问题所采取的步骤吗?我不想复制你已经完成的工作。
标签: javascript jquery materialize