You need to reference layui's css js first
The renderings are as follows:
the code
<i class="layui-icon layui-icon-tips" lay-tips="最大长度为16个文字" ></i>
$('*[lay-tips]').on('mouseenter', function () {
var content = $(this).attr('lay-tips');
this.index = layer.tips('<div style="padding: 0px; font-size: 14px; color: #eee;">' + content + '</div>', this, {
time: -1
, maxWidth: 280
, tips: [2, '#3A3D49']
});
}).on('mouseleave', function () {
layer.close(this.index);
});
tips: [2, '#3A3D49']
That number is the displayed direction and the color behind it is the background color
tips: The configuration type, that is, the position [1 top; 2 right; 3 bottom; 4 left, font color]