Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
fixed absolute positioning error for tooltip
adding position correction algorithm to tooltip display
Line 151: Line 151:
var parentPos = findPos(parentObj);
var parentPos = findPos(parentObj);
var frameObj = document.getElementById('tooltipframeidx-' + _activeTooltipIdx);
var frameObj = document.getElementById('tooltipframeidx-' + _activeTooltipIdx);
var windowSize = getWindowSize();
frameObj.style.left = ((x - parentPos.x) + _posCorrectionX) + 'px'; //500
if((frameObj.offsetWidth + parentPos.x) < windowSize.width) {
frameObj.style.top = ((y - parentPos.y) + _posCorrectionY) + 'px'; //105
frameObj.style.left = ((x - parentPos.x) + _posCorrectionX) + 'px';  
frameObj.style.top = ((y - parentPos.y) + _posCorrectionY) + 'px';  
}else {
}
}
}
return false;
return false;
Line 171: Line 176:
position.y = curtop;
position.y = curtop;
return position;
return position;
}
function getWindowSize() {
  var size = new Object();
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    size.width = window.innerWidth;
    size.height = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    size.width = document.documentElement.clientWidth;
    size.height = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    size.width = document.body.clientWidth;
    size.height = document.body.clientHeight;
  }
  return size;
}
}
function showTooltip(id) {
function showTooltip(id) {