Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How would I discover the text in a block element hidden by overflow:hidden style being set?

Reply
Thread Tools

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

 
 
SolarCanine
Guest
Posts: n/a
 
      09-20-2005
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?

 
Reply With Quote
 
 
 
 
km0ti0n
Guest
Posts: n/a
 
      09-20-2005

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....28407808750000

Hope that helps

 
Reply With Quote
 
 
 
 
SolarCanine
Guest
Posts: n/a
 
      09-20-2005
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!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
Would you like to discover how to flood your website with FREEtraffic with #1, #2, or even #5 rankings? dating the right mate ASP .Net 0 11-27-2007 01:22 AM
Would you like to discover how to flood your website with FREEtraffic with #1, #2, or even #5 rankings? dating the right mate ASP .Net 0 11-27-2007 01:22 AM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57