jQuery-photoClip裁剪图片部分问题解决

目前网上photoClip裁剪图片的例子使用的jquery版本都比较低,没有3.0以上的,这样如果项目中使用3.0以上的Jquery版本,再使用网上的例子进行图片裁剪时就会报错,无法进行图片裁剪

(1)Jquery3.0移除了load()、unload()、error()等方法

Breaking change: .load(), .unload(), and .error() removed

These methods are shortcuts for event operations, but had several API limitations.
 The event .load() method conflicted with the ajax .load() method.
 The .error() method could not be used with window.onerror because of the way the DOM method is defined. 
If you need to attach events by these names, use the .on() method, e.g. change $("img").load(fn) to $("img").on("load", fn)

从网上下载的jquery.photoClip.js使用的依旧是load()方法,如下

此时,需要将$img.load(imgLoad);修改为$img.on('load',imgLoad);即可 

2.从jQuery1.8开始,.andSelf()方法已经被标注过时,在jQuery1.8和更高版本中应使用.addBack()。

从网上下载的jquery.photoClip.js使用的依旧是andSelf()方法,如下:

此时将andSelf改为andBack即可 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值