Because the text that goes into the draggable().resizable() is dynamic. Text
length could be anything, and even the fontFamily, fontSize, etc. could be
different, so I could not explicitly set the width each time.


On Fri, Oct 23, 2009 at 2:39 PM, Brandon Ryall <[email protected]>wrote:

>
> Why not just set a width in the css initially?
>
> I do something similar, except height on my project.
> $("#dragItem").resizable({
>       resize: function(ev, ui) {
>              $curHeight = $(this).css("height");
>       }
> });
>
> On Oct 23, 9:13 am, bluetrain <[email protected]> wrote:
> > How do you determine the initial width of a draggable().resizable()
> > div, after just instantiating it, without doing anything else to it?
> > The div contains text, and it is obvious that jQuery must know its own
> > width, or else (presumably) the resizable borders would not be
> > perfectly flush with the text.
> >
> > I have drilled down into the $(id)[0] object, including all
> > childNodes, looking for any “width” property which may be useful
> > (style.pixelWidth, clientWidth, posWidth, scrollWidth, offsetWidth,
> > etc.). (This may not be a complete list of “width” properties, but I
> > assure you I have looked through every last property that looks like
> > it would represent a width of any kind.) What I’m seeing is that these
> > various “width” properties are either zero, a blank string, or have
> > some useless value, such as clientWidth = 7 (pixels), which is way
> > wrong because I can see that it is more like 100.
> >
> > I have put breakpoints on every line in the jQuery code where the
> > string “width” occurs (whole word or any part of a word)  and none of
> > these get hit during instantiation (or none of the lines where a
> > variable could be equal to the string “width” get hit with said
> > variable equal to “width”). So I can’t tell when/if jQuery ever
> > explicitly sets/gets a width property at any time.
> >
> > As a workaround, I have found that if I manually resize the div, then
> > look at the style.pixelWidth, then and only then does it give me a
> > valid width property.
> >
> > Any other ideas on how to do this without requiring manual resizing of
> > every single text-containing draggable().resizable() div?
> >
>

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