Javascript to detect coordinate of an element

  • artcoder
  • Student
  • Student
  • User avatar
  • Joined: Feb 27, 2007
  • Posts: 89
  • Loc: United States
  • Status: Offline

Post February 1st, 2009, 12:06 pm

I have an element (a link actually) where on mouse over, I display a hidden layered div using Javascript. But I want this div to be located right underneath the link element.

Due to fact that the page centers horizontally, the link element is in different coordinate on the browser window depending on how the user resizes their window. So I need Javascript code to detect where this link element is (the x and the y) and then position that div on that x and y.

A reference to a tutorial or code example would be good.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 1st, 2009, 12:06 pm

  • joebert
  • Orange Lover
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 12486
  • Loc: FL
  • Status: Offline

Post February 2nd, 2009, 1:37 pm

Here's one example.

If you're already using jQuery for something, here's another example.
Patience.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 167 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2010 Unmelted, LLC. Driven by phpBB © 2010 phpBB Group.