Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
未捕获引用错误:未定义jQuery-Magento 2.3_Jquery_Magento_Fancybox 3 - Fatal编程技术网

未捕获引用错误:未定义jQuery-Magento 2.3

未捕获引用错误:未定义jQuery-Magento 2.3,jquery,magento,fancybox-3,Jquery,Magento,Fancybox 3,我试图让fancybox在Magento 2.3中工作(使用Infortis Ultimo主题) 但我得到了: 1. Uncaught ReferenceError: jQuery is not defined 2. Uncaught TypeError: fancyboxExample.init is not a function 我正在尝试使用以下解决方案: 错误 我使用通过default\u head\u blocks.xml加载以下内容 谁能解释一下? 谢谢,您需要的JS配置应该

我试图让fancybox在Magento 2.3中工作(使用Infortis Ultimo主题)

但我得到了:

1. Uncaught ReferenceError: jQuery is not defined 
2. Uncaught TypeError: fancyboxExample.init is not a function
我正在尝试使用以下解决方案:

错误

我使用
通过
default\u head\u blocks.xml
加载以下内容

谁能解释一下?
谢谢,

您需要的JS配置应该是

File: app/design/frontend/Store/theme/requirejs-config.js

  var config = {
    map: {
      '*': {
        fancybox: 'js/vendor/fancybox3/jquery.fancybox.min'
         }
     },
    shim: {
            'fancybox': {
                deps: ['jquery']
            }
        }
 };

如果您使用的是自定义js,那么应该使用define而不是require
File: app/design/frontend/Store/theme/requirejs-config.js

  var config = {
    map: {
      '*': {
        fancybox: 'js/vendor/fancybox3/jquery.fancybox.min'
         }
     },
    shim: {
            'fancybox': {
                deps: ['jquery']
            }
        }
 };