From d2576883bf775191d6e44e615cdd401eac524be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Nov=C3=A1=C4=8Dek?= Date: Sat, 2 Mar 2019 11:15:16 +0100 Subject: [PATCH] buttonMaxWidth functionality usable to limit button width --- dist/js/bootstrap-multiselect.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/js/bootstrap-multiselect.js b/dist/js/bootstrap-multiselect.js index 2a028b77..81459b5c 100644 --- a/dist/js/bootstrap-multiselect.js +++ b/dist/js/bootstrap-multiselect.js @@ -403,6 +403,7 @@ buttonClass: 'btn btn-default', inheritClass: false, buttonWidth: 'auto', + buttonMaxWidth: 'auto', buttonContainer: '
', dropRight: false, dropUp: false, @@ -489,6 +490,17 @@ this.$container.css({ 'width': this.options.buttonWidth }); + } else + // Manually add button max-width if set. + if (this.options.buttonMaxWidth && this.options.buttonMaxWidth !== 'auto') { + this.$button.css({ + 'max-width' : this.options.buttonMaxWidth, + 'overflow' : 'hidden', + 'text-overflow' : 'ellipsis' + }); + this.$container.css({ + 'max-width': this.options.buttonMaxWidth + }); } // Keep the tab index from the select.