enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

Fire Open/Closed Event #93

Open pangolingo opened 10 years ago

pangolingo commented 10 years ago

Does the current code offer a way to fire an event when a tooltip has opened or closed?

Obviously we could independently track mouseovers/etc of the target element, but it would be convenient to write an event handler for, say, 'opentipOpen' or something like that.

Or perhaps a way to pass in a callback function as an option. It could be called when the tooltip status changes.

Would these be useful?

Yogu commented 10 years ago

+1 That would be really useful to do more advanced stuff like listening on events in the opentip. That would require @tooltipElement being exposed in the event.

jabberfest commented 10 years ago

I think it would be cleaner to allow the user to define custom onClose and onShow callback functions. Then you could do whatever you want when the tooltip was displays or closed.