소스 검색

add ability to pragmatically specify some css. fixes #121

Igor Vaynberg 13 년 전
부모
커밋
f9f3d6f4f3
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      select2.js

+ 5 - 4
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);
         },