Just to clarify the code posted; I am setting the helper's width and
height here:

$('.sort_block').sortable({
        ....
        start: function(e, ui) {
                $(ui.helper).height(50);
                $(ui.helper).width (50);
                $(ui.helper).css({width:"50px",height:"50px"}).addClass
("sort_helper");
        }
        ....
});

So on the start of the drag, the helper's width and height is set, and
it is given a new class.  Some of that code is redundant, but I wanted
to show what I've been trying.  $(ui.helper).width(50); is what I
expected would update the helpers "proportions", but it doesn't.
Instead the proportions used are that of what has been cached, causing
the boundary to be off by the original item's dimensions.

Looking at the jquery UI code, I see that the _cacheHelperProportions
() method is called on mousestart; which I guess happens BEFORE the
"start" call where the new dimensions have been set.  I figure all I
need to do is recache those proportions AFTER the start call, but I
don't know how to call that method from within the scope....  Am I off
base here?  Is there an easier way to do this?





On Feb 12, 12:14 pm, phats <[email protected]> wrote:
> Hi,
>
> I'm using a clone helper for my sortable list, and it's working great
> except that I am applying a style to the helper so that the helper
> element is a smaller size than the original item element.  So, for
> example, the item in the list is 100x100px, and the helper is 50x50px.
>
> The problem becomes noticeable when I apply a containment.  For some
> reason the helper's proportions do not change to 50x50px, and remain
> 100x100px, causing the edge of the helper to hit the containment
> boundary incorrectly.
>
> Is there a way to refresh the helper's proportions?  I noticed in the
> code it is cacheing it.  How can I call this function from outside of
> the library?
>
> Here is my code:
> $(function() {
>                 $('.sort_block').sortable({
>                         connectWith: ['.sort_block'],
>                         helper: 'clone',
>                         appendTo: 'body',
>                         opacity: .5,
>                         tolerance: 'pointer',
>                         cursorAt: {top:25,left:24},
>                         scroll: false,
>                         update: function(e, 
> ui){$(ui.item).css({width:"",height:""});},
>                         containment: $('#body_body'),
>                         start: function(e, ui) 
> {$(ui.helper).height(50);$(ui.helper).width
> (50); $(ui.helper).css({width:"50px",height:"50px"}).addClass
> ("sort_helper");}
>                 });
>         });
--~--~---------~--~----~------------~-------~--~----~
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