Javascript popup above the page fold!

S

SlimBiker

Hi,

Is there a way to open a javascript popup such that it is positioned
above the page fold and always visible.

I have a page which has links, each link on mouseover shows a DHTML
popup. but on the link near the bottom of the page the DHTML popup
shows up only half way and user has to scroll down to see the full
popup. I want to ensure that the popup opens up in a way that it is
always completely visible.

Any help will be greatly appreciated.

Regards,
SB
 
N

Noah Sussman

function positionElOnscreen(someId, elTop, elHeight) {
var topz= elTop;
var heightz= elHeight;
topz = (document.body.clientHeight - (heightz + 20));
document.getElementById(someId).style.top = topz;
}

function aboveTheFold (someId, elTop, elHeight) {
if (document.body.clientHeight < (elTop + elHeight)) {
positionElOnscreen(someId, elTop, elHeight);
}
}


NOTE: The "extra" variables (topz, heightz) are a necessary
workaround, see http://www.quirksmode.org/js/cross_dhtml.html

This code works in IE6 and FF 1.5, and AFAIK Safari. However, this
feature is currently in use by at least one of my clients, and I
haven't heard any complaints about it. So it may work pretty well in
other browsers as well.

There's a working example here:

http://www.onemorebug.com/meme.washer/code_examples/aboveTheFold_javascript.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top