【发布时间】:2015-02-06 14:15:49
【问题描述】:
我正在使用 Codeigniter 框架和引导程序,在这个安装中我有一些子页面,其中一个我试图拥有一个无限滚动加载器。 为此,我使用从本教程gridScrollFx.js 下载的 jQuery。 这是我的 JS 文件:
;( function( window ) {
'use strict';
var docElem = window.document.documentElement,
support = { animations : Modernizr.cssanimations },
animEndEventNames = {
'WebkitAnimation' : 'webkitAnimationEnd',
'OAnimation' : 'oAnimationEnd',
'msAnimation' : 'MSAnimationEnd',
'animation' : 'animationend'
},
// animation end event name
animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ];
...
...
// add to global namespace
window.GridScrollFx = GridScrollFx;
} )( window );
我从控制台收到此错误:此行的“未定义不是函数”:
animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' )
我试图产生这种效果的页面如下所示:
<head>
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/themes/<?php echo $this->config->item("theme"); ?>/normalize.css" type="text/css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/themes/<?php echo $this->config->item("theme"); ?>/component.css" type="text/css" />
<script src="<?php echo base_url(); ?>assets/js/modernizr.custom.js"></script>
</head>
<div class="container">
<section class="grid-wrap">
<ul class="grid swipe-right" id="grid">
<li><a href="#"><img src="<?php echo base_url(); ?>assets/css/themes/<?php echo $this->config->item("theme"); ?>/images/dummy.png" alt="dummy"><h3>A fantastic title</h3></a></li>
...
...
</ul>
</section>
<script src="<?php echo base_url(); ?>assets/js/imagesloaded.pkgd.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/colorfinder-1.1.js"></script>
<script src="<?php echo base_url(); ?>assets/js/masonry.pkgd.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/gridScrollFx.js"></script>
<script src="<?php echo base_url(); ?>assets/js/classie.js"></script>
<script>
new GridScrollFx( document.getElementById( 'grid' ), {
viewportFactor : 0.4
} );
</script>
</div>
我该如何解决这个 Javascript 问题?
【问题讨论】:
标签: javascript php twitter-bootstrap codeigniter