项目使用了layui的穿梭框,对着layui官方文档复制到代码中发现文本溢出了穿梭框。如下:
解决办法:
可以看到layui生成的穿梭框数据到ul下面的集合。如果直把穿梭框加上overflow: scroll,这样会影响穿梭框的头部,我想的是在给ul嵌套一层div,代码如下:
funjnction initTransferAddDiv(){
$("[data-index='0'] ul").wrapAll("<div style='overflow: scroll;height:172px'></div>");
$("[data-index='1'] ul").wrapAll("<div style='overflow: scroll;height:172px'></div>");
}
执行代码必须放到穿梭框生成的后面:
最终效果: