javascript – Materialise Cssmodal显示$(..)leanmodal不是函数错误

前端之家收集整理的这篇文章主要介绍了javascript – Materialise Cssmodal显示$(..)leanmodal不是函数错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试使用下面的代码创建一个实现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>

Error Image

我也试过了this question.

解决方法

也许你正在使用Materialize 0.97.8,它不再支持leanModal(它只是简单地改为模态 – 检查 Materialize Documentation.

我也遇到了这个问题,并使用Materialise 0.97.7解决了这个问题.

原文链接:https://www.f2er.com/js/159469.html

猜你在找的JavaScript相关文章