Try this, Kai,
function obj_xxx() {
$("#test").draggable();
// Other stuff as normal..
this.otherMethod= function() {...}
}
This way, the draggable code will fire when you instantiate the
function object.
The $( function(){}); wrapper in your example isn't firing because
it's not in the scope of the loaded document, but within function
obj_xxx() scope.
**--** Steve
On Apr 2, 9:16 am, Kai Sellgren <[email protected]> wrote:
> Hi,
>
> I am using objects in JS and I am trying to add draggable() into a DIV
> that works when I move the function out of the object context.
>
> Example:
> function obj_xxx() {
> this.init = function() {
> $(function() { $("#test").draggable();
> }
>
> }
>
> testobj = new obj_xxx();
> testobj.init();
>
> That does not work. However, if I do this:
>
> testobj = new obj_xxx();
> testobj.init();
> $(function() { $("#test").draggable();
>
> Then it will work... because the draggable is not within the object.
>
> I need this to work within the object, because I will have several
> DIVs associated with objects and I need them to have draggable() in
> specific cases.
>
> Help?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---