无法让 magnific popup 工作,两个 javascript 错误

2023-09-30前端开发问题
21

本文介绍了无法让 magnific popup 工作,两个 javascript 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试制作一个灯箱画廊并使用了示例源代码.

I am trying to make a lightbox gallery and have used the example source code.

这是我阅读的文档:http://dimsemenov.com/plugins/magnific-popup/documentation.html

Uncaught TypeError: undefined is not a function

Uncaught ReferenceError: $ is not defined 

我不确定错误的含义或如何处理它们.

在我观看的一个视频教程中,他们说 jquery 冲突是一个潜在问题.在网站的另一个页面上,我使用了 Kwicks 滑动菜单(也使用了 jquery).这是我唯一能想到的.

In a video tutorial I watched, they said something about a jquery conflict being a potential problem. On a different page of the website, I used a Kwicks sliding menu (which also used jquery). That's the only thing I can think of.

非常感谢您能给我的任何帮助!

I would really appreciate any help you would be able to give me!

谢谢!没有更多的错误,但现在我需要通过放大放大光标使悬停在图像上工作.

我已经完成了悬停工作,现在我需要进行放大放大光标的工作.我附上了一个页面,说明光标悬停时的样子.

示例:http://dimsemenov.com/plugins/magnific-popup/

我找到了缩放光标!感谢所有的帮助!

推荐答案

插件的文档 Magnific popup 您正在使用的建议 -

The documentation of the plugin Magnific popup you are using suggests -

包括文件

<!-- jQuery 1.7.2+ or Zepto.js 1.0+ -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 

<!-- Magnific Popup core JS file -->
<script src="magnific-popup/jquery.magnific-popup.js"></script>

记住:您需要包含 jQuery 文件引用,插件才能工作;而是每个 jQuery 插件.并按照指定的顺序.这是 $ not definedundefined in not a function 背后的唯一原因.

Remember : You need to include jQuery file reference, for the plugin to work; rather every jQuery plugin. And in the specified order. This is the sole reason behind $ not defined and undefined in not a function.

这篇关于无法让 magnific popup 工作,两个 javascript 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

js删除数组中指定元素的5种方法
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22 前端开发问题
182

layui 实现实时刷新一个外部的div
主页面上显示了一个合计,在删除和增加的时候需要更改这个总套数的值: //html代码div class="layui-inline layui-show-xs-block" style="margin-left: 10px" id="sumDiv"spanSOP合计:/spanspan${totalNum}/spanspan套/span/div 于是在我们删除这个条数据后,...
2024-11-14 前端开发问题
156

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui laydate日期时间范围,时间默认设定为23:59:59
在Layui中,如果你想设置日期时间选择器(datetime)的默认结束时间为当天的23:59:59,你可以使用如下代码: laydate.render({ elem: '#test10' ,type: 'datetime' ,range: true ,max: '{:date("Y-m-d 23:59:59")}' ,ready: function(date){ $(".layui-laydat...
2024-10-24 前端开发问题
279

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

layui中表单会自动刷新的问题
layui中表单会自动刷新的问题,因为用到layui的表单,遇到了刷新的问题所以记录一下: script layui.use(['jquery','form','layer'], function(){ var $ = layui.jquery, layer=layui.layer, form = layui.form; form.on('submit(tijiao)', function(data){ a...
2024-10-23 前端开发问题
262