首页 > 解决方案 > 从 jquery 中删除库的依赖项

问题描述

以前的开发人员已经包含了这样的 jquery -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

在这个 jquery 中有一行作为

this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration)

所以在我的项目中添加了另一个js -jquery.easing.1.3.js

似乎这个 js 在悬停时会产生反弹效果,但我不确定。所以我已经注释掉了包含 easing.js 的代码。现在浏览器控制台抛出错误 -

jquery.min.js:4 Uncaught TypeError: f.easing[i.animatedProperties[this.prop]] is not a function
    at fx.step (jquery.min.js:4)
    at h (jquery.min.js:4)
    at fx.custom (jquery.min.js:4)
    at fx.show (jquery.min.js:4)
    at HTMLDivElement.g (jquery.min.js:4)
    at Function.dequeue (jquery.min.js:2)
    at jquery.min.js:2

所以我的基本要求是在点击时显示/隐藏一个 div,而不是在 easing.js 完成的悬停时显示/隐藏一个 div。所以我想删除 easing.js 依赖。可能吗?

标签: javascriptjqueryjquery-easing

解决方案


推荐阅读