diff options
author | 文翼 <wenzhixin2010@gmail.com> | 2013-08-06 06:32:04 -0700 |
---|---|---|
committer | 文翼 <wenzhixin2010@gmail.com> | 2013-08-06 06:32:04 -0700 |
commit | 308aa386d6f560fa2cb2a2a4c7be7ad5c84a685e (patch) | |
tree | 669ae64fe038a2daa3f6311e65c6c26b9e5977ba /jquery.multiple.select.js | |
parent | 6edac235543c9e5e2a70292ecad842c79cc2ccbd (diff) | |
parent | 04d173b8193960b3d4e4e7b980e1c4475aa42aa7 (diff) | |
download | multiple-select-308aa386d6f560fa2cb2a2a4c7be7ad5c84a685e.zip multiple-select-308aa386d6f560fa2cb2a2a4c7be7ad5c84a685e.tar.gz multiple-select-308aa386d6f560fa2cb2a2a4c7be7ad5c84a685e.tar.bz2 |
Merge pull request #14 from guli/patch-1
Save the select width before to hide it.
Diffstat (limited to 'jquery.multiple.select.js')
-rw-r--r-- | jquery.multiple.select.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js index 672c438..7e3cd7b 100644 --- a/jquery.multiple.select.js +++ b/jquery.multiple.select.js @@ -11,6 +11,7 @@ function MultipleSelect($el, options) { var that = this; + var elWidth = $el.width(); this.$el = $el.hide(); this.options = options; @@ -25,10 +26,10 @@ if (this.$el.prop('disabled')) { this.$choice.addClass('disabled'); } - this.$choice.css('width', $el.width() + 'px') - .find('span').css('width', ($el.width() - 28) + 'px'); + this.$choice.css('width', elWidth + 'px') + .find('span').css('width', (elWidth - 28) + 'px'); this.$drop.css({ - width: (options.width || $el.width()) + 'px' + width: (options.width || elWidth) + 'px' }); $('body').click(function(e) { |