Pages doesn't load properly until mouse movement

Discussion in 'Javascript' started by Chris, Oct 26, 2008.

  1. Chris

    Chris Guest

    My web hosts uses an apache server and I find that the ajax related
    content of my pages don't appear unless there is some mouse movement
    over the related area? I am guessing it is something to do with the
    functions I am using below but I am not js savy.

    How would I fix this?

    Thanks,

    Chris

    //////////////////////////////////////////////////////////////////////////////
    function xDocSize()
    {
    var b=document.body, e=document.documentElement;
    var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
    if (e) {
    esw = e.scrollWidth;
    eow = e.offsetWidth;
    esh = e.scrollHeight;
    eoh = e.offsetHeight;
    }
    if (b) {
    bsw = b.scrollWidth;
    bow = b.offsetWidth;
    bsh = b.scrollHeight;
    boh = b.offsetHeight;
    }

    sWindowHeight = esh;

    return {w:Math.max(esw,eow,bsw,bow),h:Math.max(esh,eoh,bsh,boh)};
    }
    //////////////////////////////////////////////////////////////////////////////
    window.size = function()
    {
    var w = 0;
    var h = 0;

    //IE
    if(!window.innerWidth)
    {
    //strict mode
    if(!(document.documentElement.clientWidth == 0))
    {
    w = document.documentElement.clientWidth;
    h = document.documentElement.clientHeight;
    }
    //quirks mode
    else
    {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
    }
    }
    //w3c
    else
    {
    w = window.innerWidth;
    h = window.innerHeight;
    }
    return {width:w,height:h};
    }

    window.center = function()
    {
    var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:
    0};

    var _x = 0;
    var _y = 0;
    var offsetX = 0;
    var offsetY = 0;

    //IE
    if(!window.pageYOffset)
    {
    //strict mode
    if(!(document.documentElement.scrollTop == 0))
    {
    offsetY = document.documentElement.scrollTop;
    offsetX = document.documentElement.scrollLeft;
    }
    //quirks mode
    else
    {
    offsetY = document.body.scrollTop;
    offsetX = document.body.scrollLeft;
    }
    }
    //w3c
    else
    {
    offsetX = window.pageXOffset;
    offsetY = window.pageYOffset;
    }

    _x = ((this.size().width-hWnd.width)/2)+offsetX;
    _y = ((this.size().height-hWnd.height)/2)+offsetY;

    return{x:_x,y:_y};
    }
     
    Chris, Oct 26, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luc The Perverse

    Question! Capture Mouse Movement :)

    Luc The Perverse, Oct 24, 2005, in forum: Java
    Replies:
    16
    Views:
    4,028
    Roedy Green
    Oct 30, 2005
  2. TogaKangaroo
    Replies:
    2
    Views:
    2,091
    Ioannis Vranos
    Feb 12, 2005
  3. stringy
    Replies:
    4
    Views:
    352
    stringy
    Jul 21, 2005
  4. Jp Calderone
    Replies:
    5
    Views:
    581
    Christopher Subich
    Jul 21, 2005
  5. Chris
    Replies:
    0
    Views:
    83
    Chris
    May 27, 2009
Loading...

Share This Page