summaryrefslogtreecommitdiffhomepage
path: root/plugin/zoom-js/zoom.js
diff options
context:
space:
mode:
authorGreg Denehy2017-04-30 17:42:16 +0930
committerGreg Denehy2017-04-30 17:42:16 +0930
commitf8bc6791827b7a291081a32ef3d86f5e23d186e7 (patch)
tree87b004b3f1b0575757de6c42bace8f5330926ae0 /plugin/zoom-js/zoom.js
parent40a46e1c0c7836bdc26d25993a5c785be82e9973 (diff)
parent360bc940062711db9b8020ce4e848f6c37014481 (diff)
Merge branch 'dev' into plugin-key-bindings
Diffstat (limited to 'plugin/zoom-js/zoom.js')
-rw-r--r--plugin/zoom-js/zoom.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugin/zoom-js/zoom.js b/plugin/zoom-js/zoom.js
index 95093e0..8738083 100644
--- a/plugin/zoom-js/zoom.js
+++ b/plugin/zoom-js/zoom.js
@@ -11,7 +11,17 @@
if( event[ modifier ] && isEnabled ) {
event.preventDefault();
- var bounds = event.target.getBoundingClientRect();
+ var bounds;
+ var originalDisplay = event.target.style.display;
+
+ // Get the bounding rect of the contents, not the containing box
+ if( window.getComputedStyle( event.target ).display === 'block' ) {
+ event.target.style.display = 'inline-block';
+ bounds = event.target.getBoundingClientRect();
+ event.target.style.display = originalDisplay;
+ } else {
+ bounds = event.target.getBoundingClientRect();
+ }
zoom.to({
x: ( bounds.left * revealScale ) - zoomPadding,