var docScrollTop = $(document).scrollTop(), docScrollLeft =
$(document).scrollLeft();

See

http://docs.jquery.com/CSS/scrollTop

http://docs.jquery.com/CSS/scrollLeft

- Richard

On Wed, Jul 15, 2009 at 5:56 AM, snitch <maximilian.mut...@googlemail.com>wrote:

>
> Hello,
>
> for opening a PopUp Window I use the Popup.js from Adrian "yEnS" Mato
> Gondelle.
> Adrian has written a function to center the popup by calculating the
> window height/with and popup width/height as well ans putting the
> coord in the middle of these coordinates. Like this:
>
> function centerPopup(){
>        //request data for centering
>        var windowWidth = document.documentElement.clientWidth;
>        var windowHeight = document.documentElement.clientHeight;
>        var popupHeight = $("#popupContact").height();
>        var popupWidth = $("#popupContact").width();
>        //centering
>        $("#popupContact").css({
>                "position": "absolute",
>                "top": windowHeight/2-popupHeight/2,
>                "left": windowWidth/2-popupWidth/2
>        });
>        //only need force for IE6
>
>        $("#backgroundPopup").css({
>                "height": windowHeight
>        });
>
> }
> My Problem with this is, that it only centers the Popup correctly if
> you haven't scrolled down the page. What I need is a jQuery way to get
> the height of the actually scolled position to calculate the correct
> value for the top css parameter as well, to get my PopUp every time in
> the correct top/left position without having this scrolling bug.
>
> Is there a way in jQuery how I can get the scrolled down coordinates?
> I need the height of the scrolled position and by adding the half
> height of the screen resolution I have the css top value which I need
> here.
>
> Best Regards, May someone can help me?
>
> Marcel

Reply via email to