具有未捕获的TypeError错误:$(...)。flexslider不是函数
在内联Js中初始化flexslider时,尽管在延迟的外部js中加载了flexslider,
这是代码
function parseJSAtOnload() {
var moduleJsPath = "<?php echo BASE_URL.SHARED_ADDONPATH.'modules/fj/js/';?>";
var links = [moduleJsPath + "flexslider/jquery.flexslider.js",moduleJsPath + "lazyload.min.js"],
headElement = document.getElementsByTagName("head")[0],
linkElement, i;
for (i = 0; i < links.length; i++) {
linkElement = document.createElement("script");
linkElement.src = links[i];
headElement.appendChild(linkElement);
}
}
if (window.addEventListener)
window.addEventListener("load", parseJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", parseJSAtOnload);
else window.onload = parseJSAtOnload;
window.onload = function(){
$('.slider').flexslider({
selector: ".form-group > .col-md-3",
animation: "slide",
animationLoop: false,
itemWidth: 370,
itemMargin: 5,
maxItems:4,
controlNav: false,
slideshow: false,
mousewheel:true
});
}
答案 0 :(得分:0)
gauche <= droite
不在正确的路径上。解决方案:直接在
jquery.flexslider.js
中应用parseJSAtOnload()
功能 标签。
您收到:<script>
错误:
检查此更新:
TypeError: $(...).flexslider is not a function