473,497 Members | 2,051 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calculate amount of space required/resize div height


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
6 1651
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
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
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
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
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
Lightbox forum:
http://www.huddletogether.com/forum/

- JDD
Jul 9 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2060
by: arkascha | last post by:
Hi everybody, after trying 'round for hours and wishing all browser engine programmers to hell :-) I'd like to ask if anyone knows a solution for this: A dynamically created html page contains a...
4
16600
by: ivan | last post by:
Hi, How can we calculate the stack and heap size requried by a C program. Is there any specific formula used? Please suggest. regards, Ivan
0
1228
by: Rod Billett | last post by:
The included html contains 3 divs. One primary Div, with 2 nested divs. the second nested DIV contains an empty table. Problem 1: Phantom Space. When viewed within the browser, the div 'action...
2
1478
by: DraguVaso | last post by:
Hi, I have to DataGrid's on a form, one on the top of my form, the other at the bottom, but they though each other somewhere in the middle. What I want now is that, when I resize the form, they...
15
5297
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
6
7451
by: Programador | last post by:
I'm getting this error when running this program: Cannot calculate rate using the arguments provided Module Module1 Sub Main() Rate(360, -694.44444444444446, 244274.69178082192) End Sub
3
2458
by: Jim Langston | last post by:
I really am not sure if this question belongs in this newsgroup, but not sure where else to ask it. There is someone working on a game that I tested, and it was taking >30 seconds to load. He...
8
7191
by: removeps-groups | last post by:
Is there any way to control the space between top of browser or frame and document body? What I have is this: There is a simple file test1.html, and file test.html that displays test1.html in an...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.