如何在页面加载时加载magnific popup模式 [英] how to load magnific popup modal on page load

查看:189
本文介绍了如何在页面加载时加载magnific popup模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在页面加载时加载我的大胆弹出模式,但是我无法理解文档中的语法。如何在页面加载时调用模态?

I'm trying to load my magnific popup modal on page load, however I can't quite understand the syntax in the documentation. How do I call the modal on page load?

我的HTML:

<div id="test-modal" class"white-popup-block mfp-hide">
    <h1>Modal Test</h1>
    <p>
    Test Some text.
    </p>
    <p>
    <a class="popup-modal-dismiss">Dismiss</a>
    </p>
</div>

我的JS:

$(window).load(function(){

???? What code should I place???
});

我已经预装了脚本和css文件,我在JS里面键入什么来加载它加载弹出窗口?

I have already preloaded the script and css files, what do I type inside the JS to make it load the popup on load?

推荐答案

试试这个:

$.magnificPopup.open({
    items: {
        src: '<div id="test-modal" class="white-popup"><h1>Modal Test</h1><p>Test Some text.</p><p><a class="popup-modal-dismiss">Dismiss</a></p></div>',
        type:'inline'
    },
    modal: true
});

小提琴 ...

这篇关于如何在页面加载时加载magnific popup模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆