TypeError: $(...).magnificPopup 不是函数 [英] TypeError: $(...).magnificPopup is not a function

查看:42
本文介绍了TypeError: $(...).magnificPopup 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 chrome 开发者版.该库未加载,我不知道为什么.在chrome控制台中报告了错误.这是我的代码:

I'm on chrome developer edition. The library is not loaded and I can't figure out why. The error is reported in the chrome console. This is my code:

<ul><li><a class="mediaimage-link" href="~/img/HP/mediakit/The-CorPath-Vascular-Robotic-System_HR.jpg"><img src="~/img/HP/The-CorPath-Vascular Robotic-System-187.jpg" alt="">
</a></li>
<li><a href="https://www.youtube.com/watch?v=TnQsToiKKgw?rel=0&amp;showinfo=0" class="popup-youtube"> <img src="~/img/HP/Iyer-Video-187.jpg" alt=""></a>
         </li>
</ul>

$(document).ready(function() {
  //Media Image Popup
  $('.mediaimage-link').magnificPopup({type:'image'});
  //Video Iframe Popup
    $('.popup-youtube').magnificPopup({
          disableOn: 700,
          type: 'iframe',
          mainClass: 'mfp-fade',
          removalDelay: 160,
          preloader: false,
          fixedContentPos: false
        });
});`

推荐答案

您可能没有在代码中包含 JQuery 库.请记住,JQuery 文件必须放在所有其他 Javascript 代码之上.

You may not have included the JQuery library in your code. Remember that the JQuery file must be placed above all other Javascript code.

这篇关于TypeError: $(...).magnificPopup 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆