Javascript popup above the page fold!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SlimBiker

    Javascript popup above the page fold!

    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

  • Noah Sussman

    #2
    Re: Javascript popup above the page fold!


    function positionElOnscr een(someId, elTop, elHeight) {
    var topz= elTop;
    var heightz= elHeight;
    topz = (document.body. clientHeight - (heightz + 20));
    document.getEle mentById(someId ).style.top = topz;
    }

    function aboveTheFold (someId, elTop, elHeight) {
    if (document.body. clientHeight < (elTop + elHeight)) {
    positionElOnscr een(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:



    SlimBiker wrote:[color=blue]
    > 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[/color]

    Comment

    Working...