By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

calculate amount of space required/resize div height

P: n/a

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?
Jul 7 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
doug wrote:
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.
Jul 7 '08 #2

P: n/a
On Jul 7, 7:36 am, Stevo <n...@mail.invalidwrote:
doug wrote:
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.

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.
Jul 7 '08 #3

P: n/a
doug wrote:
On Jul 7, 7:36 am, Stevo <n...@mail.invalidwrote:
>doug wrote:
>>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.

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
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jul 7 '08 #4

P: n/a
On Jul 7, 8:43 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
doug wrote:
On Jul 7, 7:36 am, Stevo <n...@mail.invalidwrote:
doug wrote:
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.
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
--
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. :-)
Jul 7 '08 #5

P: n/a
doug wrote:
Thomas 'PointedEars' Lahn wrote:
>[...]
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
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jul 7 '08 #6

P: n/a
Lightbox forum:
http://www.huddletogether.com/forum/

- JDD
Jul 9 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.