【发布时间】:2018-10-22 18:38:27
【问题描述】:
我已经获得了一些需要用于我的 ionic 2 项目的 JQuery 代码。如何包含它和 JQuery 库?
代码如下(这只是其中的一部分):
// on 'Left Down' button click:
jQuery('body').on('click', '.left-down', function (e) {
jQuery('body #top-scale').stop();
jQuery('body .right-hand-weight').stop();
jQuery('body .left-hand-weight').stop();
//top of scale animation
jQuery("body #top-scale").animate({
transform: "rotate("+ setWeights(3,0) +"deg)"
})
//===rotate + reposition each weight ***
jQuery("body .right-hand-weight").animate({
transform:"rotate("+ getWeights() +"deg) translateX("+getX("right")+"px,"+getY("right")+"px)"
})
jQuery("body .left-hand-weight").animate({
transform:"rotate("+ getWeights() +"deg) translateX("+getX("left")+"px,"+getY("left")+"px)"
})
//console.log(getWeights());
// set number value in weight
jQuery( "body .text-1" ).text( leftWeightPercentage );
});
我想在 index.htm 中为 JQuery 库和给定的 jquery 代码文件放置一个脚本 src 标记,但我不知道如何将代码导入到我的 ionic 2 项目中。
【问题讨论】:
-
我正在考虑在 index.htm 中为 JQuery 库和给定的 jquery 代码文件添加一个脚本 src 标签,但我不知道如何将代码导入我的离子 2 项目。
标签: jquery typescript ionic2