最佳答案
如果您使用的是 jQuery,您可以只监听窗口加载事件,然后像这样为您的 Magnific Popup 调用 open 方法:
(function($) {
$(window).load(function () {
// retrieved this line of code from http://dimsemenov.com/plugins/magnific-popup/documentation.html#api
$.magnificPopup.open({
items: {
src: 'someimage.jpg'
},
type: 'image'
// You may add options here, they're exactly the same as for $.fn.magnificPopup call
// Note that some settings that rely on click event (like disableOn or midClick) will not work here
}, 0);
});
})(jQuery);
关于javascript - 如何在页面加载时打开一个宏伟的弹出窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18726419/