summaryrefslogtreecommitdiffstats
path: root/bubble.js
diff options
context:
space:
mode:
Diffstat (limited to 'bubble.js')
-rw-r--r--bubble.js34
1 files changed, 32 insertions, 2 deletions
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();