简体   繁体   English

BackboneJS Magnific Popup不起作用

[英]BackboneJS Magnific Popup not working

I have this Backbone App where I want to use the Magnific Popup for my login. 我有这个Backbone App,我想在其中使用Magnific Popup进行登录。 So I created a View 所以我创建了一个视图

var userTopNavigation = Backbone.View.extend({
        tagName: 'ul',
        className : 'nm',
        template: 'userNavigationItem',
        events: {
            'click .login': 'login',
        },
        login: function(e){
            e.preventDefault();
            $('.login').magnificPopup({
                disableOn: 700,
                type: 'inline',
                removalDelay: 160,
                preloader: false,
                fixedContentPos: false
            });
        }
});

My HTML-userNavigationItem template looks like: 我的HTML-userNavigationItem模板如下所示:

<li>
  <a href="#" class="login">
      <span class="navpptxt">Login</span>
  </a>  
</li>

Then on my index.php I placed the popup: 然后在我的index.php上放置弹出窗口:

<div id="loginbox" class="white-popup mfp-hide">...some content here...</div>

So I can see that the Magnific popup -script is loaded and the only thing what happens is that when I click the <a href="#" class="login"> - the Modal bagground gets loaded, but not my popup!!? 因此,我可以看到Magnific popup -script已加载,唯一发生的是,当我单击<a href="#" class="login"> -加载了Modal bagground,但没有加载我的弹出窗口! ?

What could be the issue here? 这里可能是什么问题? Do i have to place the popup div somewhere else? 我是否必须将弹出div放置在其他位置?

您想使用弹出式窗口而不是登录按钮来调用登录框:$('#loginbox')。magnificPopup({

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM