X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=bubble.js;h=1d715b10cd3147733b12c6e2ae654c4558ce47c4;hp=74ad4605750396cb5ee138d02a77f4029d911ea6;hb=39d7e6848af1c296332eb05214c59f23ecc4a348;hpb=1f8f27b4ac3afc282c9d7aecd91953498a40f8ee diff --git a/bubble.js b/bubble.js index 74ad460..1d715b1 100644 --- a/bubble.js +++ b/bubble.js @@ -39,9 +39,11 @@ function bindBubbles(e){ if(window.addEventListener){ lbActions[i].addEventListener("mouseover",attachBubble,false); lbActions[i].addEventListener("mouseout",detachBubble,false); + lbActions[i].addEventListener("click",detachBubble,false); }else{ lbActions[i].attachEvent("onmouseover",attachBubble); lbActions[i].attachEvent("onmouseout",detachBubble); + lbActions[i].attachEvent("onclick",detachBubble); } } } @@ -62,31 +64,31 @@ 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) { - var _f=findPos(_c)[1]-283; - var _mT=16; - var _mL=12; + if(cur_height >= get_page_height()) { + var _f=findPos(_c)[1]-363; + var _mL=2; + var _mT=39; bubbleImage = bubbleImageUp; } else { var _f=findPos(_c)[1]+17; - var _mT=27; - var _mL=12; + var _mL=2; + var _mT=34; bubbleImage = bubbleImageDown; } if (BrowserDetect.browser == 'Explorer') { - _10.style.width="240px"; + _10.style.width="275px"; _10.style.position="absolute"; _10.style.top=_f; _10.style.zIndex=99999; _10.style.left=_e; _10.style.textAlign="left"; - _10.style.height="190px"; + _10.style.height="275px"; _10.style.paddingTop="0"; _10.style.paddingLeft="0"; _10.style.paddingBottom="0"; @@ -97,17 +99,24 @@ function attachBubble(_b){ _10.style.marginRight="0"; _10.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bubbleImage + "',sizingMethod='image')"; } else { - _10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+_f+"px ; left: "+_e+"px ; background: url("+ bubbleImage +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;"); + _10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+_f+"px ; left: "+_e+"px ; background: url("+ bubbleImage +") no-repeat; width: 275px; height: 275px; padding: 0; margin: 0;"); } if (BrowserDetect.browser == 'Safari' || BrowserDetect.browser == 'Konqueror' ) { var _height = _f; - _10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+ _height +"px ; left: "+_e+"px ; background: url("+ bubbleImage +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;"); + _10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+ _height +"px ; left: "+_e+"px ; background: url("+ bubbleImage +") no-repeat; width: 275px; height: 275px; padding: 0; margin: 0;"); } + if(cur_height >= get_page_height()) + showBubbleDetails(_10, _c.id, 'up'); + else + showBubbleDetails(_10, _c.id, 'down'); + + return; + var img=document.createElement("img"); _10.appendChild(img); @@ -141,12 +150,6 @@ function detachBubble(_12){ } } -/*if(window.addEventListener){ - addEventListener("load",bindBubbles,false); -}else{ - attachEvent("onload",bindBubbles); -}*/ - function findPos(obj){ var _14=curtop=0; if(obj.offsetParent){ @@ -273,5 +276,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();