mirror of https://gitee.com/karson/fastadmin.git
新增tip和查看大图功能
parent
8439298f98
commit
9e162bd8ab
|
|
@ -221,6 +221,24 @@ define(['fast', 'moment'], function (Fast, Moment) {
|
|||
if ($(".layer-footer").size() > 0 && self === top) {
|
||||
$(".layer-footer").show();
|
||||
}
|
||||
//点击包含data-tips-image的元素弹出预览图片,在需要使用的img元素增加 data-tips-image="图片地址" 即可
|
||||
$(document).on('click', '[data-tips-image]', function () {
|
||||
var img = new Image(), src = this.getAttribute('data-tips-image') || this.src;
|
||||
var imgWidth = this.getAttribute('data-width') || '480px';
|
||||
img.onload = function () {
|
||||
var $content = $(img).appendTo('body').css({background: '#fff', width: imgWidth, height: 'auto'});
|
||||
layer.open({type: 1, area: imgWidth, title: false, closeBtn: 1, skin: 'layui-layer-nobg', shadeClose: true, content: $content, end: function () {
|
||||
$(img).remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
img.src = src;
|
||||
});
|
||||
//鼠标移入包含data-tips-text的元素触发tips提示,在需要使用的元素增加 data-tips-text="提示文字" 即可
|
||||
$(document).on('mouseenter', '[data-tips-text]', function () {
|
||||
var text = $(this).attr('data-tips-text'), placement = $(this).attr('data-tips-placement') || 'auto';
|
||||
$(this).tooltip({title: text, placement: placement}).tooltip('show');
|
||||
});
|
||||
}
|
||||
};
|
||||
Backend.api = $.extend(Fast.api, Backend.api);
|
||||
|
|
|
|||
Loading…
Reference in New Issue