On 9/16/06, limodou <[EMAIL PROTECTED]> wrote:
> I want to implement center() effect, but I don't know how to get the
> correct widht and height of the browser client. I googled and found
> that in (FF) I should use windows.innerHeight and window.innerWidth,
> but in msie I could use document.documentElement.clientWidth and
> document.documentElement.clientHeight.
>
> I want to know is jQuery has a shortcut function to get that? I write
> a simple function to do that:
>
> $.clientCoords = function(){
>     if(window.innerHeight || window.innerWidth){
>         return {w:window.innerWidth, h:window.innerHeight}
>     }
>     return {
>         w:document.documentElement.clientWidth,
>         h:document.documentElement.clientHeight
>     }
> }
>
>
It seems that clientWidth, clientHeight not correct, so I changed to
offsetWidth and offsetHeight, so the code should be:

$.clientCoords = function(){
    if(jQuery.browser.msie){
        return {
            w:document.documentElement.offsetWidth,
            h:document.documentElement.offsetHeight
        }
    }
    else
        return {w:window.innerWidth, h:window.innerHeight}
}



-- 
I like python!
My Blog: http://www.donews.net/limodou
UliPad Site: http://wiki.woodpecker.org.cn/moin/UliPad
UliPad Maillist: http://groups.google.com/group/ulipad

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to