PDA

View Full Version : Drop-in content box - Absolute Positioning



ludy
06-16-2005, 03:31 PM
Hi all,
I am a new to the forums and had a question about the Drop-in content box. I am currently using this on a website and am very happy with the results, however, I am having trouble controling the absolute positioning.

The content box contains an inline style that sets the left and top position. The left works fine the the top doesn't work for me. The only way I can modify the top position is to change the actual javascript and even then I can't get it down to an exact pixel.

The question is
Is there a way to control the absolute top and left positioning of the content box using just css.

Thanks in advance.
Ludy

jscheuer1
06-16-2005, 06:01 PM
Short answer: No.

I've used this script, highly modified, on a site I master. I recall that the vertical position was difficult to get exact and that it required editing the script. I'm not sure I ever got it exact rather, I recall getting it about where I wanted it vertically. Things get even more complicated when the page you are dropping down over is displayed at various resolutions. Bear in mind that this is a drop down box, meant to cover other content and thrust itself into the user's attention. It also can be dismissed to render the content underneath it visible once again.

Added Later:

This is where the 'action' is as far as the vertical position goes:
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}Let's take a look at those two red lines:
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits100 is a limit. Once the box is 100px from the top, dropping stops. 40 is an increment. It is the number of pixels the box drops at a time. By making the increment smaller and adjusting the limit, you can achieve a fairly exact final vertical position for the top of the box.

ludy
06-16-2005, 09:55 PM
Thanks for your help. I was able to get the content box where I wanted it by changing the value on "40+calunits". Thanks Again

dtljr
06-20-2005, 06:36 AM
Hi. How can I change the script so the menu drops down on exit instead of onload AND make sure it closes when a surfer clicks on a link inside it??

Thank you for your time.

Dave
Las Vegas