Javascript popup above the page fold!

Discussion in 'Javascript' started by SlimBiker, Jun 5, 2006.

  1. SlimBiker

    SlimBiker Guest


    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.

    SlimBiker, Jun 5, 2006
    1. Advertisements

  2. SlimBiker

    Noah Sussman Guest

    function positionElOnscreen(someId, elTop, elHeight) {
    var topz= elTop;
    var heightz= elHeight;
    topz = (document.body.clientHeight - (heightz + 20));
    document.getElementById(someId) = 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

    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:
    Noah Sussman, Jun 5, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.