document.observe('click', function(e, el) {
if (e.target != Element.descendantOf('calendar')) {
$('calendar').fade();
}
});
当在某个容器外注册点击时,我正在尝试做一些事情。在我上面的代码中,它是 $('calendar').
上述方法无效。
最佳答案
document.observe('click', function(e, el) {
if ( ! e.target.descendantOf('calendar')) {
Effect.toggle('calendar', 'appear', {duration: 0.4});
}
});
我认为这现在有效。如果有人有更好的东西。我会很高兴听到他们的声音
关于javascript - 我如何使用原型(prototype)捕捉某些容器外的点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2371383/