layer

layer是一个web弹层组件,详细介绍

xheditor

xhEditor是一个基于jQuery开发的简单迷你并且高效的可视化HTML编辑器,基于网络访问并且兼容IE 6.0+,Firefox 3.0+,Opera 9.6+,Chrome 1.0+,Safari 3.22+,详细介绍

问题

根据官方使用说明,写了如下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$(function(){
$('#addText').click(function(){
layer.open({
type: 1,
title:"add some text",
area: ['801px', '405px'], //宽高
content: $('#xh'),
end: function(){
$('#content').xheditor(false);
}
});
$('#content').xheditor({tools:'Pastetext,FontSize,FontColor,BackColor,|,Bold,Italic,Align,List,Outdent,Indent,Hr,Table,Source',skin:'nostyle'});
});
$('#btnOk').click(function(){
$('#litext').html($('#content').val());
layer.closeAll();
});
});

能够正常运行,但是在弹出层中的工具栏点击却没有反应,经过原因的查找,发现是xheditor的skin样式的问题,z-index小于layer的弹出层的z-index,导致xheditor的层被layer遮住了。

解决方法

修改nostyle样式的css文件,使其z-index大于layer弹出层的z-index

源代码