summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiao yu <t-xyu@microsoft.com>2013-12-11 11:37:59 +0800
committerxiao yu <t-xyu@microsoft.com>2013-12-11 11:37:59 +0800
commitf52d92a086395a858bdf414fbc5210903f94c332 (patch)
treeaecbb9c4034023f4ccdae4f0235c9126b56b1b0f
parent33244021f5d70504af06f9d76b3bc852d81a414b (diff)
downloadmultiple-select-f52d92a086395a858bdf414fbc5210903f94c332.zip
multiple-select-f52d92a086395a858bdf414fbc5210903f94c332.tar.gz
multiple-select-f52d92a086395a858bdf414fbc5210903f94c332.tar.bz2
add container support
-rw-r--r--jquery.multiple.select.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index 5df1fe9..8762086 100644
--- a/jquery.multiple.select.js
+++ b/jquery.multiple.select.js
@@ -194,6 +194,11 @@
this.options.isopen = true;
this.$choice.find('>div').addClass('open');
this.$drop.show();
+ if (this.options.container) {
+ var offset = this.$drop.offset();
+ this.$drop.appendTo($(this.options.container));
+ this.$drop.offset({ top: offset.top, left: offset.left });
+ }
if (this.options.filter) {
this.$searchInput.val('');
this.filter();
@@ -205,6 +210,13 @@
this.options.isopen = false;
this.$choice.find('>div').removeClass('open');
this.$drop.hide();
+ if (this.options.container) {
+ this.$parent.append(this.$drop);
+ this.$drop.css({
+ 'top': 'auto',
+ 'left': 'auto'
+ })
+ }
this.options.onClose();
},
@@ -379,6 +391,7 @@
filter: false,
width: undefined,
maxHeight: 250,
+ container: null,
onOpen: function() {return false;},
onClose: function() {return false;},