【发布时间】:2023-04-10 22:34:02
【问题描述】:
我已经尝试过官方的 jQuery Mobile 弹出窗口,现在也尝试了Magnific Popup 插件,它们都在我的页面上显示弹出窗口的内容,而不是隐藏它并稍后在模式中显示它。
index.php:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="magnific.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="magnific.js"></script>
<script src="moment.js"></script>
<script src="livestamp.min.js"></script>
<script src="main.js"></script>
</head>
<body>
<div class="wrapper">
<!-- Like so: -->
<a href="#test-popup" class="open-popup-link">Show inline popup</a>
<!-- Or like so: -->
<a href="mobile-friendly-page.html" data-mfp-src="#test-popup" class="open-popup-link">Show inline popup</a>
<!-- Popup itself -->
<div id="test-popup" class="white-popup mfp-with-anim mfp-hide">You may put any HTML here. This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.</div>
main.js:
$(document).ready(function() {
$('.open-popup-link').magnificPopup({
type:'inline',
midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
});
});
由于某种奇怪的原因,弹出窗口没有出现,而是在index.php 上看到了它的内容。 jQuery-Mobile Popup 结果相同。我做错了什么?
【问题讨论】:
标签: jquery jquery-mobile popup magnific-popup