| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>jQuery UI Controlgroup - Split Button</title> |
| 6 | <link rel="stylesheet" href="../../themes/base/all.css"> |
| 7 | <link rel="stylesheet" href="../demos.css"> |
| 8 | <style> |
| 9 | .ui-button-icon-only.demo-splitbutton-select { |
| 10 | width: 1em; |
| 11 | } |
| 12 | </style> |
| 13 | <script src="../../external/requirejs/require.js"></script> |
| 14 | <script src="../bootstrap.js" data-modules="button checkboxradio selectmenu"> |
| 15 | $( "select" ).selectmenu({ |
| 16 | classes: { |
| 17 | "ui-selectmenu-button": "ui-button-icon-only demo-splitbutton-select" |
| 18 | }, |
| 19 | change: function(){ |
| 20 | $( ".output" ).append( "<li>" + this.value + "</li>" ); |
| 21 | } |
| 22 | }); |
| 23 | $( ".controlgroup" ).controlgroup(); |
| 24 | $( "button" ).on( "click", function() { |
| 25 | $( ".output" ).append( "<li>Running Last Action...</li>" ); |
| 26 | }); |
| 27 | </script> |
| 28 | </head> |
| 29 | <body> |
| 30 | <div class="widget"> |
| 31 | <h1>Split button</h1> |
| 32 | <div class="controlgroup"> |
| 33 | <button>Run last option</button> |
| 34 | <select> |
| 35 | <option>Open...</option> |
| 36 | <option>Save</option> |
| 37 | <option>Delete</option> |
| 38 | </select> |
| 39 | </div> |
| 40 | <br> |
| 41 | <h3>Output:</h3> |
| 42 | <ul class="output"></ul> |
| 43 | </div> |
| 44 | <div class="demo-description"> |
| 45 | <p>A controlgroup creating a split button, by combining a button and a selectmenu. We adjust the classes option on the selectmenu to show only the icon</p> |
| 46 | </div> |
| 47 | </body> |
| 48 | </html> |