我正在使用。在添加JS和CSS文件后,我得到了这个错误TypeError:
$(...).on is not a function at this line in js file
"return $('body').on('click',
'a[rel^=lightbox], area[rel^=lightbox]', function(e) {"
有人能帮我理解这里的问题吗?
我在CakePHP 1.3中实现了这个功能。
我想用西佛尼的webpack-安可来收录.
我在这里创建了一个实用的jsFiddle演示:。它使用了与我相同版本的引导、jQuery和。
然而,在我的本地Symfony项目中,它不起作用。当我单击"lightboxed“图像时,会在浏览器控制台中得到以下错误:
Uncaught TypeError: Cannot read property 'Constructor' of undefined
at new Lightbox (ekko-lightbox.js:97)
at HTMLAnchorElement.<anonymous> (ekko-lightb
我已经创建了从其中加载模板的静态目录。 {% load static %} 我得到这个错误的原因是 django.template.exceptions.TemplateSyntaxError: Could not parse the remainder: '/bootstrap4/popper.js'' from 'styles/bootstrap4/popper.js'' Hare是我加载bootstarp的方式。 <script src="{% static 'js/jquery-3.2.1.min.js'
我检查了PyCharm知识库和"Google“,但是找不到与django模板注释相同的”独立“JavaScript文件。
在Django中,生成html页面时不会呈现以下内容(如果JavaScript代码在模板文件中,也适用于html代码):
{# this won't be rendered #}
// this will be rendered
来源:
由于我希望将JavaScript代码从模板中分离出来(将其放在mySeparetedJsCode.js中并通过脚本标记包含它),django模板{# comment #}不再工作了。
有人知道解决这个问题的办法吗?