javascript - 放大弹出模式内的链接不起作用

标签 javascript html magnific-popup

我有一个非常简单的放大弹出模式,其中有一个链接。但是,当单击链接时,不会加载 URL,继续的唯一方法是关闭模式。这是我启动弹出窗口的代码:

jQuery(document).ready(function( $ ) {
    $('.popup-content').magnificPopup({
            type: 'inline',
            fixedContentPos: true,
            fixedBgPos: true,
            overflowY: 'scroll',
            closeBtnInside: true,
            preloader: false,
            callbacks: {
                beforeOpen: function() {
                this.st.mainClass = this.st.el.attr('data-effect');
                }
            },
            midClick: true,
            removalDelay: 300
        });

});

还有我的 HTML:

<a class="popup-content" href="#modal" data-effect="my-mfp-slide-bottom">Open popup link</a>

<div id="modal" class="zoom-anim-dialog mfp-hide">
<a href="http://example.com">This link does not work</a>
</div>

最佳答案

添加onclick='window.open("https://example.com");' 到你的 anchor 标签。所以现在你的链接看起来像 <a href="http://example.com" onclick='window.open("https://example.com");'>This link does not work</a>

关于javascript - 放大弹出模式内的链接不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31631445/

相关文章:

magnific-popup - Magnific Popup - 视频库中的计数器

javascript - 从函数返回的数组 - TypeError : callback is not a function

html - 使用 ID 跳转到超链接的问题

jquery - 在 magnific-popup 中自定义放置的箭头

html - 中心 Bootstrap 导航栏标题

javascript - 在 HTML 表头中添加类似 excel 的元素列表

javascript - 宏伟的弹出窗口不起作用

javascript - 带有嵌套对象的 AngularJS 过滤器

php - 循环遍历 jQuery 语句

javascript - 如何知道 url 是否已添加书签