backend-init.js 751 B

123456789101112131415161718192021222324
  1. define(['backend'], function (Backend) {
  2. });
  3. $('body').on('click', '[data-tips-image]', function () {
  4. var img = new Image();
  5. var imgWidth = this.getAttribute('data-width') || '480px';
  6. img.onload = function () {
  7. var $content = $(img).appendTo('body').css({background: '#fff', width: imgWidth, height: 'auto'});
  8. Layer.open({
  9. type: 1, area: imgWidth, title: false, closeBtn: 1,
  10. skin: 'layui-layer-nobg', shadeClose: true, content: $content,
  11. end: function () {
  12. $(img).remove();
  13. },
  14. success: function () {
  15. }
  16. });
  17. };
  18. img.onerror = function (e) {
  19. };
  20. img.src = this.getAttribute('data-tips-image') || this.src;
  21. });