selectize dropdown is overlapped

时间:2015-11-12 11:42:24

标签: javascript jquery html css selectize.js

hello i am using selectize to make tags but the problem with that is that i am getting the selectize drop down overlapped by other div .

what i am doin is like

   <div style='width:300px;height:40px;float:left;'> // if needed i can modify this div css
   <?=functionToGetTags();?> // this is the function which is called here ...
   </div>

PHP

 function functionToGetTags(){
       <script src="tags/selectize.js"></script>
    <link rel="stylesheet" href="tags/selectize.default.css"/>
    <div class="control-group">
             <select id="<?=$getid_i?>" multiple name="dept[]" class="demo-default" >
                 <option value=""><?=$placehol?></option>
                  <?php if ($tagwhats =='depts'){
              // something to get ....
              } else if($tagwhats =='skills'){
               // something here ...
              } ?>
             </select>
          </div>
        <script>
              var eventHandler = function(name) {
            return function() {
                console.log(name, arguments);
                $('#log').append('<div><span class="name">' + name + '</span></div>');
            };
        };
        var $select = $('#'+"<?=$getid_i?>").selectize({
            create          : true,
            onChange        : eventHandler('onChange'),
            onItemAdd       : eventHandler('onItemAdd'),
            onItemRemove    : eventHandler('onItemRemove'),
            onOptionAdd     : eventHandler('onOptionAdd'),
            onOptionRemove  : eventHandler('onOptionRemove'),
            onDropdownOpen  : eventHandler('onDropdownOpen'),
            onDropdownClose : eventHandler('onDropdownClose'),
            onFocus         : eventHandler('onFocus'),
            onBlur          : eventHandler('onBlur'),
            onInitialize    : eventHandler('onInitialize'),
            });
            </script> 
 }

Only issue is that the drop down is overlapped other things are working fine please suggest me something i have tried messing with z-index and position absolute . no help..

1 个答案:

答案 0 :(得分:0)

忘掉selectize.css课程。 对我有用的是:
使用以下内容创建另一个类:

.myNewClass {
  position: absolute !important;
  z-index: 999;
}

将此课程放在<select>标签内 在此之后你应该重新调整元素,但问题可能会解决。