Horizontal toolbar (top)
$('#user-toolbar').toolbar({ content: '#user-toolbar-options', position: 'top' });HTML
<div id="user-toolbar-options"> <a href="#"><i class="icon-user"></i></a> <a href="#"><i class="icon-star"></i></a> <a href="#"><i class="icon-edit"></i></a> <a href="#"><i class="icon-delete"></i></a> <a href="#"><i class="icon-ban"></i></a> </div>
Horizontal toolbar (bottom)
$('#user-toolbar').toolbar({ content: '#user-toolbar-options', position: 'bottom' });HTML
<div id="user-toolbar-options"> <a href="#"><i class="icon-user"></i></a> <a href="#"><i class="icon-star"></i></a> <a href="#"><i class="icon-edit"></i></a> <a href="#"><i class="icon-delete"></i></a> <a href="#"><i class="icon-ban"></i></a> </div>
Horizontal toolbar with three items
$('#format-toolbar').toolbar({ content: '#format-toolbar-options', position: 'top', hideOnClick: true });HTML
<div id="format-toolbar-options"> <a href="#"><i class="icon-align-left"></i></a> <a href="#"><i class="icon-align-center"></i></a> <a href="#"><i class="icon-align-right"></i></a> </div>
Vertical toolbar (left)
$('#vertical-toolbar').toolbar({ content: '#user-toolbar-options', position: 'left' });HTML
<div id="user-toolbar-options"> <a href="#"><i class="icon-user"></i></a> <a href="#"><i class="icon-star"></i></a> <a href="#"><i class="icon-edit"></i></a> <a href="#"><i class="icon-delete"></i></a> <a href="#"><i class="icon-ban"></i></a> </div>
Vertical toolbar (right)
$('#vertical-toolbar').toolbar({ content: '#user-toolbar-options', position: 'right' });HTML
<div id="user-toolbar-options"> <a href="#"><i class="icon-user"></i></a> <a href="#"><i class="icon-star"></i></a> <a href="#"><i class="icon-edit"></i></a> <a href="#"><i class="icon-delete"></i></a> <a href="#"><i class="icon-ban"></i></a> </div>
Horizontal toolbar triggered by a link
$('#normal-button').toolbar({ content: '#user-options', position: 'top' });HTML
<div id="user-toolbar-options"> <a href="#"><i class="icon-user"></i></a> <a href="#"><i class="icon-star"></i></a> <a href="#"><i class="icon-edit"></i></a> <a href="#"><i class="icon-delete"></i></a> <a href="#"><i class="icon-ban"></i></a> </div>
<script src="jquery.min.js"></script> <script src="jquery.toolbar.js"></script>
<link href="jquery.toolbar.css" rel="stylesheet" /> <link href="bootstrap.icons.css" rel="stylesheet" />
<div id="user-toolbar-options"> <a href="#"><i class="icon-user"></i></a> <a href="#"><i class="icon-star"></i></a> <a href="#"><i class="icon-edit"></i></a> <a href="#"><i class="icon-delete"></i></a> <a href="#"><i class="icon-ban"></i></a> </div>
$('#element').toolbar( options );
.pressed
when the toolbar is visible.Option | Description |
---|---|
content | The id of the element containing the icons HTML. |
position | Indicates the display position of the toobar relative to the element its attached agaisnt. Select either 'top', 'bottom', 'left' or 'right. Default: top. |
hideOnClick | Choose if you want the toolbar to hide when anywhere outside the toolbar is clicked. Default: false. |
Below is a list of methods available on the elements that already have a toolbar instantiated
Method | Arguments | Description |
---|---|---|
getToolbarElement | None | Obtain the element that wraps every tool button |
Below are a list of events that are triggered when certain events happen with the toolbar. You can listen for these events using the .on method.
For example.$('#element').on('toolbarShown', function( event ) { // this: the element the toolbar is attached to } );
Event | Description |
---|---|
toolbarShown | Triggered when the toolbar is shown. |
toolbarHidden | Triggered when the toolbar is hidden. |
toolbarItemClick | Triggered when a button in the toolbar is clicked. The toolbar item clicked is also passed through for this event. |