将input file 上传组件替换成一张图片的简易方式

来源:互联网 发布:澳洲寄宿家庭 知乎 编辑:程序博客网 时间:2024/05/16 06:17

将input file 放在图片上层,且将其透明度设置为0

代码拷贝自:bootstrap-wysiwyg

 $('[data-role=magic-overlay]').each(function () {                var overlay = $(this), target = $(overlay.data('target'));                overlay.css('opacity', 0).css('position', 'absolute').offset(target.offset()).width(target.outerWidth()).height(target.outerHeight());            });
0 0
原创粉丝点击