How would I discover the text in a block element hidden by overflow:hidden style being set?

Discussion in 'Javascript' started by SolarCanine, Sep 20, 2005.

  1. SolarCanine

    SolarCanine Guest

    Specifically, assume I have a div tag of absolute dimensions. I need
    to figure out, first, whether or not the text inside the div tag is
    partially hidden by the overflow setting, and if so, what the hidden
    text is.

    Is this even possible? Obviously, the rendering engine in the browser
    "knows" this information, but is it accessible through Javascript?
    SolarCanine, Sep 20, 2005
    #1
    1. Advertising

  2. SolarCanine

    km0ti0n Guest

    SolarCanine wrote:
    > Specifically, assume I have a div tag of absolute dimensions. I need
    > to figure out, first, whether or not the text inside the div tag is
    > partially hidden by the overflow setting, and if so, what the hidden
    > text is.
    >
    > Is this even possible? Obviously, the rendering engine in the browser
    > "knows" this information, but is it accessible through Javascript?


    Yes it possible to find out using offsetHeight and scrollHeight.

    Here's a demo and some script :

    http://km0ti0n.blunted.co.uk/viewng.xap?ID=632628407808750000

    Hope that helps
    km0ti0n, Sep 20, 2005
    #2
    1. Advertising

  3. SolarCanine

    SolarCanine Guest

    Ok, that solves the first half of the problem (thanks!) but I'm still
    stumped as to how to get to the second piece of information I need
    (exactly what text *isn't* being displayed). Alternately, if I could
    get Javascript to tell me what text *is* being displayed, I could
    always compare that with the complete contents of the block element and
    take the difference to know what wasn't being shown.

    Thanks again, that's a handy tip about finding out whether or not the
    block is overflowing!
    SolarCanine, Sep 20, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U0FM?=
    Replies:
    2
    Views:
    12,364
    =?Utf-8?B?U0FM?=
    Jul 28, 2006
  2. morrell
    Replies:
    1
    Views:
    949
    roy axenov
    Oct 10, 2006
  3. dating the right mate
    Replies:
    0
    Views:
    257
    dating the right mate
    Nov 27, 2007
  4. dating the right mate
    Replies:
    0
    Views:
    249
    dating the right mate
    Nov 27, 2007
  5. HANM
    Replies:
    2
    Views:
    712
    Joseph Kesselman
    Jan 29, 2008
Loading...

Share This Page