如果我在元素上使用工具提示和弹出 Twitter Bootstrap Javascript 组件,我如何确定哪个组件触发了“显示”事件?
例如:
$("#button").tooltip();
$("#button").popover();
$("#button").on("shown", function(event) {
// I need to do some (flash) stuff that's specific to the popover content,
// the shown event is fired for both the tooltip and popover but doesn't
// appear to include any useful information about the context of the event.
// How do I determine if the popover component fired the event? The event.target
// is useless because it points to #button.
// The best I've come up with is to check if the element I'm interested in
// is visible but I'm assuming this will have issues if the popover component
// is animated...
if ($(".popover .thingy").is(':visible')) {
}
});