JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old March 19th, 2004, 12:42 AM
cgnovelo cgnovelo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 14 cgnovelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Problem when positioning a layer

Hi,
I have this small layer which has a monthly calendar for users to pick a date. Everything works just fine, the problem is that sometimes I need to have many date fields in a screen and the layer gets its position from the mouse position so it shows next to the button that calls it. The function is:
function showLayer(){
Layer1.style.visibility="visible";
Layer1.style.top=event.clientY+10;
Layer1.style.left=event.clientX-180;
}
The problem is that when you have to scroll down because the page gets longer, the layer shows way up. I know that this happens because x and y tell it the position of the screen but I would need to add the offset that has been scrolled. Is there a way to do this? how do I know the portion of screen that has been scrolled? If it helps, this is the code I used to create the layer.
<div id="Layer1" style="position:absolute; width:198px; height:190px;
z-index:1; left: 560px; top: 415px; visibility:hidden; background-color: #FFFFFF;
layer-background-color: #FFFFFF; border: 1px solid #000000; overflow: hidden">&nbsp;</div>
Thanks in advance.

Reply With Quote
  #2  
Old March 28th, 2004, 02:53 PM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
hey

You can use the tag, that gives you the total of the available screen, and then just calculate how far from the top of the screen the button is, and then position the button by the availabe screensize minus the absolute button position.

- Pheifel

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Problem when positioning a layer


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway