我正在使用hoverIntent Jquery插件,我有一個關於回調函數的問題。JQuery將參數傳遞給函數指針
在我以前的問題之一,有人指出,我應該使用函數指針的回調。
我的問題是這樣的:我如何將參數傳遞給函數指針呢?
function initHoverHandler(type) {
var config = {
over: overHandler, // This is the issue, how do I pass var type to overHandler
out: hideHandler
};
$(this).hoverIntent(config);
};
function overHandler(type) {
alert(type); // shows [object Object]
};
僅供參考,使用var'config'不在同一範圍在您的示例調用'hoverIntent'。 – geowa4 2009-08-10 14:57:10
固定--------- – Dirk 2009-08-10 14:59:15