当我尝试使用以下代码创建一个物化 css moal 时,出现错误。
<script src="~/Scripts/jquery-1.10.2.js"></script>
<link href="~/css/materialize.css" rel="stylesheet" />
<script src="~/js/materialize.js"></script>
<a id="btnReset" class="waves-effect waves-light btn modal-trigger" data-target="modal1">Reset</a>
<!-- Modal Structure -->
<div id="modal1" class="modal">
<div class="modal-content">
<h4>Warning !</h4>
<p>Do you really want to reset ?</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Yes</a>
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">No</a>
</div>
</div>
<script>
$(document).ready(function () {
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
我试过了 this question还有。
最佳答案
也许您正在使用 Materialise 0.97.8,它不再支持 leanModal(它只是更改为模态 - 查看 Materialize Documentation。
我也有这个问题,并通过使用 Materialise 0.97.7 解决了它。
关于javascript - Materialise Cssmodal showing $(..)leanmodal is not a function 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33635704/