1
0
mirror of synced 2025-03-10 22:56:12 +03:00
Made the dropdown menu positioned via pure css instead of using
javascript to constantly adjust its position. YAY PERFORMANCE!

Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
This commit is contained in:
Dean Sofer 2012-04-26 19:16:37 -07:00 committed by Igor Vaynberg
parent b96079fef6
commit 37ddcb64a3
2 changed files with 1 additions and 11 deletions

View File

@ -85,7 +85,7 @@
border: 1px solid #aaa; border: 1px solid #aaa;
border-top: 0; border-top: 0;
position: absolute; position: absolute;
top: 29px; top: 100%;
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15); -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
-moz-box-shadow: 0 4px 5px rgba(0, 0, 0, .15); -moz-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
-o-box-shadow: 0 4px 5px rgba(0, 0, 0, .15); -o-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);

View File

@ -525,19 +525,12 @@
return this.container.hasClass("select2-dropdown-open"); return this.container.hasClass("select2-dropdown-open");
}, },
alignDropdown: function () {
this.dropdown.css({
top: this.container.height()
});
},
open: function () { open: function () {
if (this.opened()) return; if (this.opened()) return;
this.container.addClass("select2-dropdown-open").addClass("select2-container-active"); this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
this.updateResults(true); this.updateResults(true);
this.alignDropdown();
this.dropdown.show(); this.dropdown.show();
this.focusSearch(); this.focusSearch();
}, },
@ -1230,7 +1223,6 @@
self.addSelectedChoice(this); self.addSelectedChoice(this);
}); });
self.postprocessResults(); self.postprocessResults();
this.alignDropdown();
}, },
onSelect: function (data) { onSelect: function (data) {
@ -1244,7 +1236,6 @@
} else { } else {
this.search.width(10); this.search.width(10);
this.resizeSearch(); this.resizeSearch();
this.alignDropdown();
} }
// since its not possible to select an element that has already been // since its not possible to select an element that has already been
@ -1309,7 +1300,6 @@
} }
selected.remove(); selected.remove();
this.triggerChange(); this.triggerChange();
window.setTimeout(this.bind(this.alignDropdown), 20);
}, },
postprocessResults: function () { postprocessResults: function () {