我创建一个jQuery工具对触发覆盖列示:如何禁用/删除/取消绑定jQuery覆盖?
如何禁用和稍后重新启用覆盖?我希望我的$('button')
元素保持为链接状态,但不是在点击时显示叠加层,而是想显示警报?
类似的东西:
if(needToDisableOverlay())
{
$('button').overlay().disable(); // no such thing...
$('button').bind('click.alert', function()
{
alert('The overlay has been disabled');
});
}
// later on
if(needToEnableOverlay())
{
$('button').unbind('click.alert');
$('button').overlay().enable(); // no such thing...
}
我知道我可以使用
$('button').unbind('click');
从按键上移开所有点击处理程序(包括覆盖负载()功能),但我不认为这是一种干净的方式,特别是如果我有其他点击处理程序要维护。
也许我可以在Overlay的onBeforeLoad处理程序中使用标志,并且如果设置了标志,则返回false?
实现此目的的正确性是什么?
真的,我还没有想到这个问题。我喜欢。 – 2011-03-11 15:24:29