I guess I should provide a little more info here. As I said the $("#selector").width() property is one of the meaningless/incorrect values I referred to. Interestingly, in every case the property $("#selector").width() is equal to the width of the text div's parent container, although it is clear by looking at it that it is not as wide as the parent container.
Also, the parent container is itself a draggable() div. Can't imagine why that would make a difference. So to sum up with an example using real numbers: The $("#parentDraggable").width() property equals 192 AND the parent div is obviously this width when viewing it as it is rendered on the screen. The $("#childDraggableResizable").width() property equals 192 BUT the child div is obviously not 192 pixels as it is rendered on the screen. In fact it doesn't matter whether the rendered width is 1 pixel or 191 pixels, the .width() property always reads 192. On Fri, Oct 23, 2009 at 3:47 PM, Brent Wood <bluetrai...@gmail.com> wrote: > Thanks for the suggestion, but that property is one of the ones I was > talking about when I said I had tried accessing all of the width properties > that I could find anywhere within the object and all of its childNodes, etc. > > > On Fri, Oct 23, 2009 at 3:03 PM, Brandon Ryall > <brandon.ry...@emaint.com>wrote: > >> Ah I see, try just doing $("#selector").width() that should work for you >> >> >> ------------------------------------------------- >> Brandon Ryall >> Software Developer >> eMaint Enterprises LLC >> 438 N. Elmwood Road, Suite 201 >> Marlton, NJ 08053 >> P 856-810-2700 x7180 >> F 253-323-6353 >> >> >> >> On Fri, Oct 23, 2009 at 3:50 PM, Brent Wood <bluetrai...@gmail.com>wrote: >> >>> 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 <brandon.ry...@emaint.com >>> > 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 <bluetrai...@gmail.com> 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 jquery-ui@googlegroups.com To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---