无法使用华丽弹出窗口开始使用模式弹出窗口



我已经阅读了Magnific Popup的文档,包括了这些文件,并根据以下内容从模式弹出中复制和粘贴了代码Js报价

<a class="popup-modal" href="#test-modal">Open modal</a>
<div id="test-modal" class="mfp-hide white-popup-block">
        <h1>Modal dialog</h1>
    <p>You won't be able to dismiss this by usual means (escape or click button), but you can close it programatically based on user choices or actions.</p>
    <p><a class="popup-modal-dismiss" href="#">Dismiss</a>
    </p>
</div>
$(document).ready(function () {
    $('.popup-modal').magnificPopup({
        type: 'inline',
        preloader: false,
        focus: '#username',
        modal: true
    });
    $(document).on('click', '.popup-modal-dismiss', function (e) {
        e.preventDefault();
        $.magnificPopup.close();
    });
});

但这根本不起作用,上面的代码出了什么问题?

JsFiddle中外部加载的CSS可能有问题。尝试删除外部加载的css并将内容粘贴到css选项卡中。

最新更新