I have a Tooltip (larger image view) that is being positioned via
e.pageX e.pageY and i am trying to make sure it is not hidden below
the current scrolled view port.

I have seen many sites have this my code is something like this but i
am missing something.

var positionImg = function(e) {
    var viewportWidth = $(window).width();
    var viewportHeight = window.innerHeight ? window.innerHeight : $
(window).height();
    var mouseAtY = e.pageY;
    var mouseAtX = e.pageX;
    var maxBottomVPos = viewportHeight-"i dont know";
    var maxTopVPos = 30;

    if (mouseAtY >= maxBottomVPos)
    {
        tPosX = mouseAtX+ 10;
        tPosY = mouseAtY -520;
    }
    else if (mouseAtY <= maxTopVPos)
    {
        tPosX = mouseAtX;
        tPosY = mouseAtY +40;
    }
    else
    {
        tPosX = mouseAtX;
        tPosY = mouseAtY +20;
    }
    $zoomContainer.css({top: tPosY, left: tPosX});
};

Reply via email to