简体   繁体   English

jQuery Magnific Popup根本不起作用

[英]jQuery Magnific Popup is not working at all

I have an issue with the jQuery Magnific Popup plugin, I did what I read in the documentation but it doesn't work, when I click on the link the image don't open in a popup. 我的jQuery Magnific Popup插件有问题,我做了我在文档中阅读的内容,但是当我单击该链接时,该图片没有在弹出窗口中打开,所以它不起作用。 And I have no errors. 而且我没有错误。

<a class="thumbnail" href="{{case.image}}" title="{{case.description}}">
    <img ng-src="{{case.image}}">
</a>

<script type="text/javascript">
    $(document).ready(function() {
        $('.thumbnail').magnificPopup({
            type: 'image', 
            delegate: 'a'
        });
        console.log('ok'); 
    });
</script>

I'm so sorry if it's a newbie mistake, but I looked everywhere and I don't see what's wrong, nothing wrong in the console ... Maybe there is a problem with AngularJs, but I am not an expert ... 如果这是一个新手错误,我感到很抱歉,但是我到处都看不到有什么问题,控制台中没有任何问题... AngularJs可能有问题,但是我不是专家...

Thank you a lot for your help. 非常感谢您的帮助。

I hosted my app to help you see what's wrong : http://azilizblanchet.fr/CameleonCatalogue/#/services 我托管了我的应用程序,以帮助您了解问题所在: http : //azilizblanchet.fr/CameleonCatalogue/#/services

Magnific popup requires the href attribute on the element. 宏弹出框要求元素上的href属性。 Just add it to the image tag and it should work. 只需将其添加到图片标签中,即可正常使用。

<img ng-src="{{case.image}}" href="{{case.image}}">

Try to remove delegate option. 尝试删除委托选项。

Just: 只是:

<script type="text/javascript">
    $(document).ready(function() {
        $('.thumbnail').magnificPopup({
            type: 'image'
        });
        console.log('ok'); 
    });
</script>

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

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