From: Andreas Unterkircher Date: Thu, 7 Jun 2007 10:00:01 +0000 (+0000) Subject: improved up/down handling of bubble X-Git-Tag: phpfspot-1.2~299 X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=379cde9ab362700327b496aa9aa7c612036b298e improved up/down handling of bubble git-svn-id: file:///var/lib/svn/phpfspot/trunk@36 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- 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();