braintree-web
Version:
A suite of tools for integrating Braintree in the browser
27 lines (20 loc) • 665 B
JavaScript
function top(height) {
var windowHeight =
window.outerHeight || document.documentElement.clientHeight;
var windowTop = window.screenY == null ? window.screenTop : window.screenY;
return center(windowHeight, height, windowTop);
}
function left(width) {
var windowWidth = window.outerWidth || document.documentElement.clientWidth;
var windowLeft = window.screenX == null ? window.screenLeft : window.screenX;
return center(windowWidth, width, windowLeft);
}
function center(windowMetric, popupMetric, offset) {
return (windowMetric - popupMetric) / 2 + offset;
}
module.exports = {
top: top,
left: left,
center: center,
};
;