diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-01-14 22:38:00 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-01-14 23:10:14 +0100 |
commit | 5eb6071b049bf67ebbbcd99c3424f4635134b864 (patch) | |
tree | 447f2fdc16b074f7e2447eb5dcb75a780c6b76d6 /core | |
parent | b10668638250196b5d86865e68606f6d1d24fc22 (diff) | |
download | nextcloud-server-5eb6071b049bf67ebbbcd99c3424f4635134b864.tar.gz nextcloud-server-5eb6071b049bf67ebbbcd99c3424f4635134b864.zip |
make the minimum width of the multiselect configurable
Diffstat (limited to 'core')
-rw-r--r-- | core/css/multiselect.css | 1 | ||||
-rw-r--r-- | core/js/multiselect.js | 18 |
2 files changed, 12 insertions, 7 deletions
diff --git a/core/css/multiselect.css b/core/css/multiselect.css index ee426351769..1202ea18427 100644 --- a/core/css/multiselect.css +++ b/core/css/multiselect.css @@ -1,4 +1,5 @@ ul.multiselectoptions { z-index:49; position:absolute; background-color:#fff; padding-top:.5em; border:1px solid #ddd; border-top:none; -moz-border-radius-bottomleft:.5em; -webkit-border-bottom-left-radius:.5em; border-bottom-left-radius:.5em; -moz-border-radius-bottomright:.5em; -webkit-border-bottom-right-radius:.5em; border-bottom-right-radius:.5em; -moz-box-shadow:0 1px 1px #ddd; -webkit-box-shadow:0 1px 1px #ddd; box-shadow:0 1px 1px #ddd; } +ul.multiselectoptions>li{ white-space:nowrap; overflow: hidden; } div.multiselect { padding-right:.6em; display:inline; position:relative; display:inline-block; vertical-align: bottom; } div.multiselect.active { background-color:#fff; border-bottom:none; border-bottom-left-radius:0; border-bottom-right-radius:0; z-index:50; position:relative } div.multiselect>span:first-child { margin-right:2em; float:left; } diff --git a/core/js/multiselect.js b/core/js/multiselect.js index 26380824047..610e9193bb7 100644 --- a/core/js/multiselect.js +++ b/core/js/multiselect.js @@ -9,23 +9,26 @@ 'checked':[], 'oncheck':false, 'onuncheck':false, + 'minWidth': 'default;', }; - $.extend(settings,options); + $.extend(settings,options); var button=$('<div class="multiselect button"><span>'+settings.title+'</span><span>▾</span></div>'); - if(settings.checked.length>0){ - button.children('span').first().text(settings.checked.join(', ')); - } var span=$('<span/>'); span.append(button); button.data('id',multiSelectId); button.selectedItems=[]; this.hide(); this.before(span); - settings.minWidth=button.width(); + if(settings.minWidth=='default'){ + settings.minWidth=button.width(); + } button.css('min-width',settings.minWidth); settings.minOuterWidth=button.outerWidth()-2; button.data('settings',settings); - + if(settings.checked.length>0){ + button.children('span').first().text(settings.checked.join(', ')); + } + button.click(function(event){ var button=$(this); if(button.parent().children('ul').length>0){ @@ -83,13 +86,14 @@ } var newOuterWidth=Math.max((button.outerWidth()-2),settings.minOuterWidth)+'px'; var newWidth=Math.max(button.width(),settings.minWidth); + var pos=button.position(); button.css('height',button.height()); button.css('white-space','nowrap'); button.css('width',oldWidth); button.animate({'width':newWidth},undefined,undefined,function(){ button.css('width',''); }); - list.animate({'width':newOuterWidth}); + list.animate({'width':newOuterWidth,'left':pos.left+3}); }); var li=$('<li></li>'); li.append(input).append(label); |