jQuery用户头像裁剪插件cropbox.js使用详解
几乎每一个网页是必备图片上传,图片裁剪功能,这里通过cropbox.js插件实现该功能。
$(window).load(function(){ varoptions= { thumbBox:'.thumbBox', spinner:'.spinner', imgSrc:'images/avatar.png' } varcropper=$('.imageBox').cropbox(options); $('#file').on('change',function(){ varreader=newFileReader(); reader.onload=function(e){ options.imgSrc=e.target.result; cropper=$('.imageBox').cropbox(options); } reader.readAsDataURL(this.files[0]); this.files=[]; }) $('#btnCrop').on('click',function(){ varimg=cropper.getDataURL(); $('.cropped').append(' '); }) $('#btnZoomIn').on('click',function(){ cropper.zoomIn(); }) $('#btnZoomOut').on('click',function(){ cropper.zoomOut(); }) });
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短