Solved

Finding div position

Posted on 2006-06-27
5
825 Views
Last Modified: 2008-02-01
Hi guys,

I have an div, which is:

position:absolute;
height:125px;
width:100%;

and is located inside a table.

I would like to find out the following information:

style.left;
style.right;
style.bottom;

Now, since those details are not defined in the original stylesheet, javascript returns a NULL value. Any work-arounds for this?

Cheers guys!
0
Comment
Question by:Cyber-Drugs
5 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 250 total points
ID: 16992226
No gals? ;-)
If you have position:absolute; then is the div positioned absolutely out of table and not relative to cell.
The style attributes are not set, but you can read properties like: div.offsetTop and div.offsetLeft
The property div.offsetBottom is NOT calculated for you. You have to calculate it by looking for div.scrollSize, the body scrollSize and so on.


0
 
LVL 8

Assisted Solution

by:RozanaZ
RozanaZ earned 250 total points
ID: 16992231
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 16992392
Zvonko

I did wonder how long until someone commented on that, haha! ;-)

That works perfectly, and I'm happy to calculate, as long as I get the numbers to work with, which you have provided me with!

RozanaZ

Thanks for the link, I did see it when I did a quick search, but since it's title had "position:relative", I didn't even bother to look at it, but I now see it had what I wanted. Thanks for bringing that to my attention.


Splitting the points evenly on this one, yes Zvonko was first to reply, but RozanaZ pointed out something I should of found before asking my question.


Cheers guys (and gals)
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16992510
Thanks for splitting points!
See you.
0
 
LVL 16

Expert Comment

by:alain34
ID: 16992570
I was just wondering if this library could help you
http://www.javascripttoolbox.com/lib/objectposition/
try the demo and see by yourself
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now