How to change this jQuery widget (written for jQueryUI 1.7) so that it works with jQueryUI 1.8

北城以北 提交于 2019-11-29 08:43:19

The $.widget signature changed to do the extend internally, so change this:

$.widget("ui.boxer", $.extend({}, $.ui.mouse, {

To this:

$.widget("ui.boxer", $.ui.mouse, {

And at the bottom, remove the extra ) as well, changing })); to });


Also, to get the default options, it's best to move them right inside, like this:

$.widget("ui.boxer", $.ui.mouse, {
  options: {
    appendTo: 'body',
    distance: 0
  },
  ///rest of widget, unchanged...
});

Here's a sample of the updated version with only the changes above, working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!