calculate amount of space required/resize div height

D

doug

I am loading some HTML into a lightbox div via AJAX.

What I would like to do is load the HTML into the lightbox div (a
scrollable one), then get the height of the content of the div (not
the height of the div itself which would is fixed).

Then I would like to resize the div to be the height of the content.

How can this be done? What are some attributes in the DOM that I
should look at besides height?
 
S

Stevo

doug said:
I am loading some HTML into a lightbox div via AJAX.

What I would like to do is load the HTML into the lightbox div (a
scrollable one), then get the height of the content of the div (not
the height of the div itself which would is fixed).

Then I would like to resize the div to be the height of the content.

How can this be done? What are some attributes in the DOM that I
should look at besides height?

That all sounds like it'd be better off being asked in a lightbox forum.
I imagine that any "regular JS" that tries to find out (and modify)
anything about that DIV will be fighting lightbox's own code. Their API
should let you do things like that I would think.
 
D

doug

That all sounds like it'd be better off being asked in a lightbox forum.
I imagine that any "regular JS" that tries to find out (and modify)
anything about that DIV will be fighting lightbox's own code. Their API
should let you do things like that I would think.


The one I use does not allow you to do that. I have already made
several modifications to the code. I'm not sure what you mean by
"regular JavaScript." The only thing that the lightbox code uses is
regular javascript.

What I need is to figure out what part of the DOM would allow me to do
what I need to do.

It's not really so much a "lightbox" issue as it is the more general
question of finding out how much space something takes up.
 
T

Thomas 'PointedEars' Lahn

doug said:
The one I use does not allow you to do that. I have already made
several modifications to the code. I'm not sure what you mean by
"regular JavaScript." The only thing that the lightbox code uses is
regular javascript.

The reasonable assumption was/is that direct object access might interfere
with Lightbox as the latter would already implement mechanisms that modify
or watch for object's behavior and properties.
What I need is to figure out what part of the DOM would allow me to do
what I need to do.

It's not really so much a "lightbox" issue as it is the more general
question of finding out how much space something takes up.

It is not a language issue either, although it is considered somewhat
on-topic here as you intend to access the DOM API with client-side
ECMAScript-based scripting.

The offsetWidth, offsetHeight, clientWidth, clientHeight, scrollWidth,
scrollHeight, style.width, and style.height properties of your DOM element
object are your friends (provided they have not been tampered with or are
watched for by Lightbox).

This has been asked here before. *Numerous times.* Please read and take
heed of the FAQ (yes, *all of it*!) before you post here again:

<http://jibbering.com/faq/>

BTW, Lightbox is considered junk as it is requires both Prototype.js and
Script.aculo.us which are also considered junk. Search the archives.


PointedEars
 
D

doug

The reasonable assumption was/is that direct object access might interfere
with Lightbox as the latter would already implement mechanisms that modify
or watch for object's behavior and properties.



It is not a language issue either, although it is considered somewhat
on-topic here as you intend to access the DOM API with client-side
ECMAScript-based scripting.

The offsetWidth, offsetHeight, clientWidth, clientHeight, scrollWidth,
scrollHeight, style.width, and style.height properties of your DOM element
object are your friends (provided they have not been tampered with or are
watched for by Lightbox).

This has been asked here before. *Numerous times.* Please read and take
heed of the FAQ (yes, *all of it*!) before you post here again:

<http://jibbering.com/faq/>

BTW, Lightbox is considered junk as it is requires both Prototype.js and
Script.aculo.us which are also considered junk. Search the archives.

PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16


thanks for the answer to the question, I appreciate it. :)
 
T

Thomas 'PointedEars' Lahn

doug said:
Thomas said:
[...]
This has been asked here before. *Numerous times.* Please read and take
heed of the FAQ (yes, *all of it*!) before you post here again:

<http://jibbering.com/faq/>
[...]

thanks for the answer to the question, I appreciate it. :)

In contrast, your mindless full-quoting, despite *sincere* suggestion to the
contrary, is not appreciated at all.


Score adjusted

PointedEars
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top