Skip to content

Commit f9f3d6f

Browse files
author
Igor Vaynberg
committed
add ability to pragmatically specify some css. fixes select2#121
1 parent 8b566bf commit f9f3d6f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

select2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,12 @@
401401
this.container = this.createContainer();
402402
this.body = opts.element.closest("body"); // cache for future access
403403

404-
405404
if (opts.element.attr("class") !== undefined) {
406405
this.container.addClass(opts.element.attr("class"));
407406
}
408407

408+
this.container.css(opts.containerCss);
409+
409410
// swap container for the element
410411
this.opts.element
411412
.data("select2", this)
@@ -414,6 +415,7 @@
414415
this.container.data("select2", this);
415416

416417
this.dropdown = this.container.find(".select2-drop");
418+
this.dropdown.css(opts.dropdownCss);
417419
this.dropdown.data("select2", this);
418420

419421
this.results = results = this.container.find(resultsSelector);
@@ -503,6 +505,8 @@
503505
}
504506

505507
opts = $.extend({}, {
508+
containerCss: {},
509+
dropdownCss: {},
506510
populateResults: function(container, results) {
507511
var uidToData={}, populate, markup=[], uid, data, result, children;
508512

@@ -689,9 +693,6 @@
689693
left: offset.left,
690694
width: width
691695
}
692-
if (this.opts.dropdownZIndex !== undefined) {
693-
css["z-index"] = this.opts.dropdownZIndex;
694-
}
695696
this.dropdown.css(css);
696697
},
697698

0 commit comments

Comments
 (0)