我正在尝试在我的应用程序中集中调用 jQuery .animate
$('#' + this.elmItem).animate({"top": moveTo}, speed, function() {
var item = scope.getItemSizeDom();
scope.saveItemSize(item);
}); // This works
我试图包装一个没有成功的方法,你能告诉我我做错了什么,这里有一个如何解决它的例子吗?
this.itemAnimate = function(direction, moveTo, speed) {
$('#' + this.elmItem).animate({direction: moveTo}, speed, function() {
var item = scope.getItemSizeDom();
scope.saveItemSize(item);
});// This does not work
};
this.itemAnimate("top", moveTo, "fast");