从函数传递参数到setTimeout
调用有什么问题?为什么这里的path
返回undefined
?应该怎么做呢?
$('.curatorSpace').bind('click', function() {
var path = $(this).attr('data-path');
setTimeout(function(path) {
if($('#curatorRibbon').hasClass('ui-draggable-dragging')){return false}
runOverlay(path);
}, 100);
});
setTimeout
调用您提供的函数时,setTimeout
不会向该函数传递参数。 - Stephen P