1
當mousedown
事件完成時,我想銷燬特定的彈出窗口。只要用戶按下鼠標,彈出窗口就可以看到。當用戶不在時,應該有3.5秒的延遲,那麼它應該被銷燬。在mousedown事件完成後銷燬bootstrap-popover
只要mousedown
爲真,我當前的實現就會正確顯示彈出窗口,但是當我釋放鼠標時,彈出窗口會立即銷燬,而不會延遲。我做什麼?
的jQuery:
function destroyPopover(selector)
{
setTimeout(function() {
$(selector).popover('destroy');
}, 3500);
}
...
$('#otp_table').on('mousedown', 'td', function() {
$(this).popover({
container: 'body',
content: 'Lorem ipsum',
placement: 'top',
}).popover('show');
}, hidePopover(this));