【发布时间】:2020-02-03 17:43:26
【问题描述】:
我有一个按钮,它必须隐藏一个框架集并显示以下一个
这是我的 HTML 的一部分
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="./js/scripts-bundled.js"></script>
这是调用缓动函数的地方
import $ from "jquery";
class FormController {
// variables declararations and some code not useful now...
buttonClicked(evt) {
this.current_object.animate(
{ opacity: 0 },
{
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale current_fs down to 80%
scale = 1 - (1 - now) * 0.2;
//2. bring next_fs from the right(50%)
left = now * 50 + "%";
//3. increase opacity of next_fs to 1 as it moves in
opacity = 1 - now;
this.current_object.css({
transform: "scale(" + scale + ")",
position: "absolute"
});
this.next_object.css({ left: left, opacity: opacity });
},
duration: 800,
complete: function() {
this.current_object.hide();
this.animating = false;
},
//this comes from the custom easing plugin
easing: "easeInOutBack"
}
);
}
如果我运行此代码并单击按钮,我会收到此错误 未捕获的类型错误:jQuery.easing[this.easing] 不是函数
我认为,由于某种原因,缓动插件没有正确加载。
有没有办法通过 Webpack 在代码中要求它?
谢谢
【问题讨论】:
标签: javascript jquery webpack