You can initialize it with the containment option:

$("#draggable").draggable({ containment: "#limite" });

or you can initialize it with defaults and then set the containment option:

$("#draggable").draggable();
$("#draggable").draggable("option", "containment","#limite");

but you can't just call set the containment option without an init:

$("#draggable").draggable("option", "containment","#limite");

See

http://jsbin.com/ibane

- Richard

On Mon, Aug 17, 2009 at 7:18 PM, Sandia_Man <[email protected]> wrote:

>
> Hello everybody!
> I'm new using this great library...
> I'm interested in using the draggable option... I'm doing what the
> this link (http://jqueryui.com/demos/draggable/#option-containment)
> says, but it just doesn't work... I want to set the container option
> after the init... and if I put those options nothing happens...
>
> This is my code:
>
> This WORKS:
>
> <body>
>
>     <div id="limite" style="width:400px;height:400px;border:3px
> dotted black;">
>           <div id="draggable" style="width:200px;height:200px;border:
> 2px dotted black;background:#F4EDDB;"></div>
>
>
>     </div>
> <script>
>    $("#draggable").draggable();
> </script>
> </body>
>
>
> This does NOT WORK:
>
> <body>
>
>     <div id="limite" style="width:400px;height:400px;border:3px
> dotted black;">
>           <div id="draggable" style="width:200px;height:200px;border:
> 2px dotted black;background:#F4EDDB;"></div>
>
>
>     </div>
> <script>
>    $("#draggable").draggable("option", "containment","#limite");
> </script>
> </body>
>
> I just don't understand what's happening because the documentations
> says that this should work...
>
> Thanks a lot!!
> bye!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to