bryanboling wrote:
> I'm trying to position some divs absolutely (so they
float) and I want
> them to appear at a fixed point on my page. So,
normally I'd use the
> whole {top: 100px; left: 100px;} type of set-up.
However, the page is
> centered. So, depending on the width of the user's
browser (or screen
> resolution etc...) that defined point in space doesn't
match up with
> where I want it to be.
>
> Is there an easy way to either:
>
> a)define a 0,0 point... or
> b)figure out where one point is and position my div
accordingly?
>
> Thanks,
> Bryan
Assuming you know the width in pixels of your page, it
shouldn't be too
bad. Use the innerWidth of the window to figure out how wide
the whole
thing is in pixels, then subtract the width you know you're
using, and
you know how much extra there is, making the X-offset you
need 1/2
that.
scrollTop should give you the current top, so using the two,
you should
be able to nail it.
Hope that helps,
~A!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Information googlegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
-~----------~----~----~----~------~----~------~--~---
|