简体   繁体   English

内联,绑定函数和回调编写此jQuery代码

[英]Writing this jquery code inline, bind function and callback

var callBack = function(event, ui) {
    setModel.call(this, ui);
};

this.renderer.$el.on("slide", callBack.bind(this));

Hey I need help on how to write this without callback variable. 嘿,我需要有关如何编写没有回调变量的帮助。 How to define anonymous function directly in event handler without callBack variable, and bind it to this? 如何在没有callBack变量的事件处理程序中直接定义匿名函数,并将其绑定到此? thanks. 谢谢。

You can do this 你可以这样做

this.renderer.$el.on("slide", function(event, ui) {
    setModel.call(this, ui);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM