X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=bubble.js;h=600407bd5af36bc464664d4cb3c539cc6f0376b6;hp=74ad4605750396cb5ee138d02a77f4029d911ea6;hb=16b42e8df740890bebae0f96e7411139d3992ea0;hpb=1f8f27b4ac3afc282c9d7aecd91953498a40f8ee diff --git a/bubble.js b/bubble.js index 74ad460..600407b 100644 --- a/bubble.js +++ b/bubble.js @@ -62,11 +62,11 @@ function attachBubble(_b){ document.getElementsByTagName("body")[0].appendChild(_10); _10.className="bubble"; - _iH = window.innerHeight; var _e=findPos(_c)[0]+5; + var cur_height = findPos(_c)[1]-get_scroll_position() + 283; // should the bubble be displayed above or below the object - if(findPos(_c)[1] + 240 >= _iH) { + if(cur_height >= get_page_height()) { var _f=findPos(_c)[1]-283; var _mT=16; var _mL=12; @@ -273,5 +273,35 @@ function var_dump(obj) { } }//end function var_dump +function get_page_height() +{ + var myHeight = 0; + if( typeof( window.innerHeight ) == 'number' ) { + //Non-IE + myHeight = window.innerHeight; + } else if( document.documentElement && document.documentElement.clientHeight ) { + //IE 6+ in 'standards compliant mode' + myHeight = document.documentElement.clientHeight; + } else if( document.body && document.body.clientHeight ) { + //IE 4 compatible + myHeight = document.body.clientHeight; + } + + return myHeight; +} + +function get_scroll_position() +{ + + if (typeof window.pageYOffset != 'undefined') + return window.pageYOffset; + else + if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') + return window.scrollTop; + else + if (typeof document.body != 'undefined') + return document.body.scrollTop; + +} BrowserDetect.init();