Using inherited widget on child element in Jquery Ui Widget Factory

297 Views Asked by At

I am trying to make my custom draggable widget with JQuery Ui factory, which inherits draggable.

It works fine when the element itself, but I need to use draggable only on its child element. Is it possible to use with ihreritance or I should use just apply draggable as usual?

    $.widget("ui.myDraggable", $.ui.draggable, {

        options: {
            item: null //Selector for child element
        },

        _build: function() {

            var $item = $(this.options.item);

            //This makes container draggable
            $.ui.draggable.prototype._create.call(this);

            //How can I make only inner draggable, if I still apply widget on container?
            //Something like this:
            //$.ui.draggable.prototype._create.call(this.options.item);           

        }
}

Here is my complete example: http://jsfiddle.net/vlrt/j1uogfrx/4/

0

There are 0 best solutions below