├── css ├── .gitkeep ├── screen.css └── multirow-checkbox-menu.css ├── .gitignore ├── postback.php ├── img └── multirow-checkbox-menu │ └── downarrow.png ├── HISTORY.md ├── README.md ├── index.html └── js └── jquery.multirowcheckboxmenu.js /css/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | nbproject/ -------------------------------------------------------------------------------- /postback.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/multirow-checkbox-menu/downarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpleweb/Multirow-Checkbox-Menu/HEAD/img/multirow-checkbox-menu/downarrow.png -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | jQuery Multirow-Checkbox-Menu changelog 2 | ======================================= 3 | 4 | ## 1.0.1 5 | 6 | * Fix to ensure that the multirow checkbox still appears when there are no options. 7 | 8 | ## 1.0.0 9 | 10 | * Initial public release -------------------------------------------------------------------------------- /css/screen.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: arial, verdana; 3 | font-size: 14px; 4 | font-weight: normal; 5 | } 6 | 7 | table{border-collapse:collapse;} 8 | th, td{padding:.5em 1em;line-height:1.5em;margin:0;} 9 | th{background:#eee;} 10 | td{border-bottom:1px solid #eee;} 11 | 12 | table { 13 | width: 200px; 14 | margin: 20px; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /css/multirow-checkbox-menu.css: -------------------------------------------------------------------------------- 1 | div.multiRowCheckboxMenu { 2 | font-family: arial, verdana; 3 | font-size: 12px; 4 | font-weight: normal; 5 | -moz-border-radius:3px 3px 3px 3px; 6 | -webkit-border-radius:3px 3px 3px 3px; 7 | background:-moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent; 8 | border-color:#CCCCCC #BBBBBB #A0A0A0; 9 | border-left:1px solid #BBBBBB; 10 | border-right:1px solid #BBBBBB; 11 | border-style:solid; 12 | border-width:1px; 13 | color:#000000; 14 | cursor:default; 15 | margin:0 8px 0 0; 16 | outline:medium none; 17 | padding:1px 6px 1px 4px; 18 | text-align:left; 19 | vertical-align:middle; 20 | white-space:nowrap; 21 | position: relative; 22 | float: left; 23 | height: 1%; 24 | overflow: visible; 25 | } 26 | 27 | div.multiRowCheckboxMenu.down { 28 | background:-moz-linear-gradient(center top , #E3E3E3, #ccc) repeat scroll 0 0 transparent; 29 | } 30 | 31 | div.multiRowCheckboxMenu label { 32 | float: left; 33 | height: 1%; 34 | margin: 0; 35 | } 36 | 37 | div.multiRowCheckboxMenu input.selectAll { 38 | height: 19px; 39 | } 40 | 41 | div.multiRowCheckboxMenu input.selectAll.semiSelect { 42 | opacity: 0.5; 43 | } 44 | 45 | div.multiRowCheckboxMenu span.selectedItem { 46 | float:left; 47 | margin:1px 5px; 48 | } 49 | 50 | div.multiRowCheckboxMenu a.menu { 51 | text-indent: -9999px; 52 | display: block; 53 | height: 16px; 54 | width: 16px; 55 | background: url(../img/multirow-checkbox-menu/downarrow.png) no-repeat 3px 4px; 56 | outline: none; 57 | height: 1%; 58 | float: right; 59 | } 60 | 61 | div.multiRowCheckboxMenu ul { 62 | background-color:#FFFFFF; 63 | border:1px solid #CCCCCC; 64 | left:-1px; 65 | list-style:none outside none; 66 | margin:0; 67 | position:absolute; 68 | top:25px; 69 | display: none; 70 | padding: 0; 71 | z-index: 999; 72 | } 73 | 74 | div.multiRowCheckboxMenu ul.wide { 75 | width: 300px; 76 | } 77 | 78 | div.multiRowCheckboxMenu ul.wide li { 79 | float: left; 80 | } 81 | 82 | div.multiRowCheckboxMenu ul li{ 83 | padding: 0; 84 | margin: 2px; 85 | font-size: 14px; 86 | padding: 5px; 87 | } 88 | 89 | div.multiRowCheckboxMenu ul li:hover { 90 | background-color: #3470A6; 91 | cursor: pointer; 92 | color: #fff; 93 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jQuery Plugin: Multi Row Checkbox Menu 2 | ============================== 3 | By Tom Holder - [http://www.simpleweb.co.uk](http://www.simpleweb.co.uk) 4 | 5 | Overview 6 | -------- 7 | This is an unobtrusive jQuery plugin to put those cool little Google Gmail type 'Select All/Select None' action menus at the top of a list of check boxes. 8 | 9 | Usage 10 | ----- 11 | First include the `jquery.multirowcheckboxmenu.js` file in your page. 12 | 13 | 14 | 15 | 16 | Markup your menus as follows: 17 | 18 |
19 | 20 | 21 |
22 | 23 | You will notice the markup just contains form submit buttons. This is so the functionality degrades without javascript. If Javascript is enabled, each submit input will be replaced with an element in the menu drop down. The form will be submitted with the same named action value. 24 | 25 | Then apply the multirowcheckbox plugin to the container: 26 | 27 | $('div.multiRowCheckboxMenu').checkboxMenu(); 28 | 29 | If you ID or class the submit buttons inside the container, those IDs/classes will get passed over to the LIs to provide more styling control. 30 | 31 | The plugin can also be used as a simple filter menu without the checkbox for things such as Sort Alphabetically, Filter by Letter etc. To do this, you must just have a input item with a class of selected. See index.html for example. 32 | 33 | Background 34 | ---------- 35 | 36 | [Blog post on ok-cool.com](http://www.ok-cool.com/posts/read/475-select-allselect-none-checkbox-menu-plugin-for-jquery/) 37 | 38 | This plugin was built for our fabulous ContactZilla product! [http://contactzilla.com/](http://contactzilla.com/) 39 | 40 | [Example](http://simpleweb.github.com/Multirow-Checkbox-Menu/) 41 | 42 | License 43 | ------- 44 | This plugin is licensed under both the GPL and MIT licenses. Choose which ever one suits your project best. 45 | 46 | [![ContactZilla.com](http://github.com/simpleweb/jQuery-Multi-Row-Input/raw/master/contactzilla.png)](http://contactzilla.com/) -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | Multi Row Checkbox Menu 8 | 9 | 10 | 11 | 12 | 13 | 14 | 31 | 32 | 33 | 34 |
35 | 36 | 37 | 59 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
38 | 39 | 50 | 51 | 55 | 56 | 57 | 58 | 60 | 61 | 80 |
Tom
Christos
Mark
Nigel
99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /js/jquery.multirowcheckboxmenu.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Plugin: Multi Row Checkbox Menu 3 | * Version 1.0 4 | * 5 | * Copyright (c) 2010 Tom Holder Simpleweb Ltd (http://simpleweb.co.uk) 6 | * Licensed jointly under the GPL and MIT licenses, 7 | * choose which one suits your project best! 8 | * 9 | * Built for our product ContactZilla (http://contactzilla.com/) - check it out! 10 | * 11 | * Please feel free to use this code in your projects, just respect the license and retain this header. 12 | */ 13 | (function($){ 14 | function log() { 15 | if (window.console && console.log) { 16 | for (var i = 0, len = arguments.length; i < len; i++) { 17 | console.log(arguments[i]); 18 | } 19 | } 20 | }; 21 | $.fn.checkboxMenu = function(options) { 22 | 23 | var defaults = { 24 | buttonSelector: ":submit", 25 | checkboxIDPrefix: "selectAll", 26 | checkboxClasses: "selectAll", 27 | semiSelectClass: "semiSelect", 28 | menuClass: "", 29 | menuLinkClass: "menu", 30 | downClass: "down", 31 | childCheckboxes: "input[type=checkbox]", 32 | removeSelectedItem: true, 33 | menuItemClick: function() { return true; } 34 | }; 35 | 36 | var opts = $.extend(defaults, options); 37 | var containerCount = 0; 38 | 39 | return this.each(function(){ 40 | 41 | var checkboxMenuContainer = $(this); 42 | checkboxMenuContainer.addClass('jquery-multirow-checkbox-menu-container'); 43 | 44 | //UL containing the menu. 45 | var dropdownMenu = $("