diff options
| author | ccd0 <admin@containerchan.org> | 2013-11-09 16:35:35 -0800 |
|---|---|---|
| committer | ccd0 <admin@containerchan.org> | 2013-11-09 16:35:35 -0800 |
| commit | 81dbba64e2c34b15186f30fbd76cf1cbd44038bc (patch) | |
| tree | c679773f0463baeb91dfacd0a917719165a14571 | |
| parent | 338b71498bfb1145369c3fea929351e5eda5271e (diff) | |
fix size computation for hover
| -rw-r--r-- | expandvideo.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/expandvideo.js b/expandvideo.js index 4ecddd60..8d6124b3 100644 --- a/expandvideo.js +++ b/expandvideo.js @@ -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"; |
