[英]Javascript Error: Uncaught TypeError: undefined is not a function
我正在尝试解决此问题。我无法加载此脚本http://orangeplacehotel.com/superbudget/ems-policy 。 这段代码有什么问题吗? 我试着放警报,它可以正常工作,但仍然看不到该站点上加载的插件。.请帮助..谢谢,
$(function() { $('#nanoGallery1').nanoGallery({ kind:'flickr', userID:'129251189@N05', touchAutoOpenDelay: -1, breadcrumbAutoHideTopLevel: true, maxWidth: 948, imageTransition : 'slide', thumbnailWidth: 200, thumbnailHeight: 126, thumbnailHoverEffect: 'scaleLabelOverImage,borderDarker', i18n: { thumbnailImageDescription: 'view photo', thumbnailAlbumDescription: 'open album' }, thumbnailLabel: { display: true, position: 'overImageOnMiddle', hideIcons: true, align: 'center' }, thumbnailLazyLoad: true }); }); alert("test");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
错误是“ NanoGallery不是函数”,我认为您应该在运行代码之前检查页面中是否包含插件(定义了nanoGaller())。
下面是可以正常工作的代码,它不是解决方案,但可能会给您一些帮助
首先包括jQuery库,然后
$.prototype.nanoGallery = function(){
console.log(arguments);
}
$(function() {
$('#nanoGallery1').nanoGallery({
kind:'flickr',
userID:'129251189@N05',
touchAutoOpenDelay: -1,
breadcrumbAutoHideTopLevel: true,
maxWidth: 948,
imageTransition : 'slide',
thumbnailWidth: 200,
thumbnailHeight: 126,
thumbnailHoverEffect: 'scaleLabelOverImage,borderDarker',
i18n: {
thumbnailImageDescription: 'view photo',
thumbnailAlbumDescription: 'open album'
},
thumbnailLabel: {
display: true,
position: 'overImageOnMiddle',
hideIcons: true, align: 'center'
},
thumbnailLazyLoad: true
});
});
alert("test");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.