查看 1146
回复 0
修正wow.js结合Animate.css使用时 config is not defined 报错
逆风天

16

主题

0

回帖

105

积分
发表于 2021-12-4 20:04:00
显示全部楼层 阅读模式

修正 wow.js 结合 Animate.css 使用时 config is not defined 报错


解决步骤一:
wow.js 搜索

  1. this.util().addEvent(box, 'animationend', this.resetAnimation);
  2. this.util().addEvent(box, 'oanimationend', this.resetAnimation);
  3. this.util().addEvent(box, 'webkitAnimationEnd', this.resetAnimation);
  4. this.util().addEvent(box, 'MSAnimationEnd', this.resetAnimation);
复制代码
修改为:
  1. this.util().addEvent(box, 'animationend', this.resetAnimation.bind(this));
  2. this.util().addEvent(box, 'oanimationend', this.resetAnimation.bind(this));
  3. this.util().addEvent(box, 'webkitAnimationEnd', this.resetAnimation.bind(this));
  4.       this.util().addEvent(box, 'MSAnimationEnd', this.resetAnimation.bind(this));
复制代码
即,增加绑定.bind(this)。
解决步骤二:
wow.js 搜索
  1. return target.className = target.className.replace(config.animateClass, '').trim();
复制代码
修改为:
  1. return target.className = target.className.replace(this.config.animateClass, '').trim();
复制代码

搞定!

修改方法参考了一位博主的解决办法,原文地址
您需要登录后才可以回帖 登录 立即注册
QQ 快速回复 返回列表