From f9f3d6f4f3d74594540d3670d0d95b59146f7c76 Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Mon, 18 Jun 2012 23:46:58 -0700 Subject: [PATCH] add ability to pragmatically specify some css. fixes #121 --- select2.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/select2.js b/select2.js index b25b4dfc..b5caa46c 100755 --- a/select2.js +++ b/select2.js @@ -401,11 +401,12 @@ this.container = this.createContainer(); this.body = opts.element.closest("body"); // cache for future access - if (opts.element.attr("class") !== undefined) { this.container.addClass(opts.element.attr("class")); } + this.container.css(opts.containerCss); + // swap container for the element this.opts.element .data("select2", this) @@ -414,6 +415,7 @@ this.container.data("select2", this); this.dropdown = this.container.find(".select2-drop"); + this.dropdown.css(opts.dropdownCss); this.dropdown.data("select2", this); this.results = results = this.container.find(resultsSelector); @@ -503,6 +505,8 @@ } opts = $.extend({}, { + containerCss: {}, + dropdownCss: {}, populateResults: function(container, results) { var uidToData={}, populate, markup=[], uid, data, result, children; @@ -689,9 +693,6 @@ left: offset.left, width: width } - if (this.opts.dropdownZIndex !== undefined) { - css["z-index"] = this.opts.dropdownZIndex; - } this.dropdown.css(css); },