fix size computation for hover

This commit is contained in:
ccd0 2013-11-09 16:35:35 -08:00
parent 338b71498b
commit 81dbba64e2

View File

@ -59,6 +59,7 @@ function setupVideo(thumb, url) {
video.style.position = "static";
video.style.maxWidth = "";
video.style.maxHeight = "";
video.style.pointerEvents = "auto";
video.style.display = "inline";
videoHide.style.display = "inline";
@ -78,11 +79,19 @@ function setupVideo(thumb, url) {
expanded = false;
hovering = true;
var docRight = document.body.parentNode.getBoundingClientRect().right;
var thumbRight = thumb.querySelector("img, video").getBoundingClientRect().right;
var maxWidth = docRight - thumbRight - 20;
if (maxWidth < 250) maxWidth = 250;
video.style.position = "fixed";
video.style.right = "0px";
video.style.top = "0px";
video.style.maxWidth = (document.body.parentNode.getBoundingClientRect().right - thumb.getBoundingClientRect().right) + "px";
var docRight = document.body.parentNode.getBoundingClientRect().right;
var thumbRight = thumb.querySelector("img, video").getBoundingClientRect().right;
video.style.maxWidth = maxWidth + "px";
video.style.maxHeight = "100%";
video.style.pointerEvents = "none";
video.style.display = "inline";
videoHide.style.display = "none";