paulkinzett / toolbar

A tooltip style toolbar jQuery plugin
http://paulkinzett.github.com/toolbar/
MIT License
2.3k stars 321 forks source link

Implemented some toolbar event triggering #9

Closed mandx closed 11 years ago

mandx commented 11 years ago

toolbaritemclick: Triggered when a button in the toolbar is clicked toolbarshown: Triggered when the toolbar is shown toolbarhidden: Triggered when the toolbar is hidden

Some times is very handy to know when the toolbar is being shown/hidden. For instance, I use the toolbar to provide formatting options to an item, and then save the item's style to the server when the toolbar is closed.

The toolbaritemclick is handy when the toolbar content is generated (like providing raw HTML), and there is no DOM node to register for events.

Dmitry-N-Medvedev commented 11 years ago

How to tell which particular button is clicked?

mandx commented 11 years ago

@Dmitry-N-Medvedev Something like:

$('.open-toolbar-btn').toolbar({ /* toolbar options... */}).on('toolbarItemClick', function (event, button) {
    /* `button` is the toolbar just clicked */
});
Dmitry-N-Medvedev commented 11 years ago

Very nice. Thanks a lot.

PS: ..and why is this not reflected in the documentation?

paulkinzett commented 11 years ago

Thanks @mandx

I had the events outlined in the documentation provided in the zip file but hadn't made the change to the web based documentation. The web documentation has been updated. Thanks for picking this up.

mandx commented 11 years ago

@paulkinzett No problem!