drd43058 2016-08-15 03:08
浏览 72

Selectize.js中选项的模态框

Is it possible to modify selectize.js? Instead of having a dropdown it will open a modal box for its options ? I am thinking of having a onfocus event then it will open that modal but prevent the dropdown. I'm just not sure how I can achieve it. and How I can populate the selectize once the modal options have been saved

  • 写回答

1条回答 默认 最新

  • dpzbh1779 2016-08-15 04:30
    关注

    It's usually not a good idea to customize a code library because you will not be able to upgrade to the next version. You are better off rolling your own solution using js and css. Actually making modal boxes is not that difficult, you just need to float a div at a higher z-index than the rest of the page, then put a transparent layer behind it to keep the user from clicking through to the background page. Here is some sample css and html I use to float a modal.

    css

    .BDT_Dialog_Layer {
    position: absolute;
    display: table;
    top: 0px;
    left: 0px;
    height: 99%;
    width: 99%;
    }
    .BDT_Dialog_Center {
    position:fixed;
    top:30%;
    width:100%;
    }
    .BDT_Dialog_Decoration {
    position:relative;
    margin:0 auto;
    text-align: center;
    background-color: #ffffff;
    display: table;    
    /* --    background-color: #DDDDDD;
        filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#FFFFFF'    , endColorstr='#BBBBBB');
    background-image: -webkit-gradient(  linear,  left top,  left bottom,  color-stop(0.1, #FFFFFF),  color-stop(1, #BBBBBB)  );
    background-image: -moz-linear-gradient(  center top,  #FFFFFF 10%,  #BBBBBB 100%  ); -- */
    -moz-border-radius: 15px;
    -webkit-border-radius: 15px;
    -khtml-border-radius: 15px;
    border-radius: 15px;
    -moz-box-shadow: 0 1px 8px #666666, 0 1px 4px #000000;
    -webkit-box-shadow: 0 1px 8px #666666, 0 1px 4px #000000;
    -khtml-box-shadow: 0 1px 8px #666666, 0 1px 4px #000000;
    box-shadow: 0 1px 8px #666666, 0 1px 4px #000000;   
    }
    

    html

    <div id="dialogLayer" class="BDT_Dialog_Layer">
        <div class="BDT_Dialog_Center">
            <div class="BDT_Dialog_Decoration">                    
                My stuff                         
            </div>
        </div>
    

    here is the blocking layer css

    div.BlockInteractionWithPage {
    position: absolute;
    top: 0px;
    left: 0px;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    background-color: #ffffff;
    opacity: 0.0;
    filter: alpha(opacity=0); /* filter:alpha for IE8 and earlier */
    height: 100%;
    width: 100%;    
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)