I’m trying to figure out how to fix this code for jQueryUI 1.8.5 and jQuery 1.5.1 and am out of luck with such advanced stuff, can anyone lend a hand?
The problem is with the code below:
$.extend($.ui.boxer, {
defaults: $.extend({}, $.ui.mouse.defaults, {
appendTo: 'body',
distance: 0
})
});
It doesn’t initialize options with appendTo and distance values for some reason.
Though I haven’t worked with jQuery UI before, I took a stab at this one for the night. It appears that you have two problems with the code you showed in jsfiddle. The first is that in UI 1.8, you no longer have to do extend when creating a widget,
Switching to this new style of declaring a widget, the error for
this._mouseInit()goes away. This was needed to be done before we can address the question you had, which was why defaults did not work. In this commit https://github.com/jquery/jquery-ui/commit/90fb45dffafc2e891b1ebca948ad33e6b94de112,ui.mouse.defaultswas replaced withoptions. Sinceoptionsis part of the widget, you now have to extend the prototype,These changes resulted in something that works ( http://jsfiddle.net/wqvJG/1/ ). BTW, what this code does is awesome :).