Set a new value when it's in a new place

$item.data("location", "newValue")

- Richard

On Fri, Mar 27, 2009 at 10:57 AM, Paul Hutson
<[email protected]>wrote:

>
> Richard,
>
> Fantastic - just what I was looking for!
>
> I now know where the item starts.. however, when it gets to the new
> location.. how do I reassociate the item with it's new home.. it seems
> to copy across the information.
>
> I'm using the following code to move the item :
>
>        // Move to Cargo function
>        function MoveToCargo($item) {
>                var $Hanger = $('#Hanger'), $Cargo = $('#Cargo');
>                $item.fadeOut(function() {
>                        $item.appendTo($Cargo).fadeIn();
>                        $item.data("location") == "Cargo";  //this was how
> I've been trying
> to reassociate it.. but no joy.
>                });
>        };
>
> Any ideas?
>
> Tia,
> Paul
>
> On Mar 27, 11:02 am, "Richard D. Worth" <[email protected]> wrote:
> > Something like this, perhaps?
> >
> > $("#draggable").draggable({
> >   start: function() {
> >     $(this).data("location", "RIGHTBOX");
> >   }});
> >
> > $("#droppable").droppable({
> >   drop: function(event, ui) {
> >     alert(ui.draggable.data("location"));
> >   }
> >
> > });
> >
> > - Richard
> >
> > On Fri, Mar 27, 2009 at 4:58 AM, Paul Hutson <
> [email protected]>wrote:
> >
> >
> >
> >
> >
> > > Thanks for the reply Shedokan.. I'm not quite sure I'm following you
> > > though. ... when I say the origin, I want to - upon clicking on an
> > > item, assign it with a start location variable (scope, or something
> > > else.. with say a value of "RIGHTBOX") then when I drop it somewhere I
> > > want to be able to read that variable back...
> >
> > > Any ideas on that front?
> >
> > > TIA,
> > > Paul Hutson
> >
> > > On Mar 26, 11:44 pm, Shedokan <[email protected]> wrote:
> > > > If your'e calling it inside a function of the draggable so you can
> use
> > > > $(ui.draggable).draggable('option', 'scope') because there is no
> > > > ui.draggable
> >
> > > > alose if you mean that you want to get the left and top position you
> > > > can use ui.offset.
> >
> > > > On 26 מרץ, 16:57, Paul Hutson <[email protected]> wrote:
> >
> > > > > As a bit of an addon... the thing I really want to do is find out
> > > > > draggable objects origin location is.
> >
>

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