
<p context-tip="自定义上下文提示信息">段落内容...</p>
<div context-tip="自定义上下文提示信息">div内容...</div>
// 悬浮提示
$("body").on("mouseenter", "*[context-tip]", function () {
var content = $(this).attr('context-tip');
this.index = layui.layer.tips('<div style="padding: 0px; font-size: 14px; color: #eee;">' + content + '</div>', this, {
time: -1
, maxWidth: 280
, tips: [3, '#3A3D49']
});
});
$("body").on("mouseleave", "*[context-tip]", function () {
layui.layer.close(this.index);
});
//$('*[context-tip]').on('mouseenter', function () {
// var content = $(this).attr('context-tip);
// this.index = layui.layer.tips('<div style="padding: 0px; font-size: 14px; color: #eee;">' + content + '</div>', this, {
// time: -1
// , maxWidth: 280
// , tips: [3, '#3A3D49']
// });
//}).on('mouseleave', function () {
// layui.layer.close(this.index);
//});