diff options
author | Hakim El Hattab | 2017-01-10 13:45:52 +0100 |
---|---|---|
committer | Hakim El Hattab | 2017-01-10 13:45:52 +0100 |
commit | a144134b42c15964f469cf4499859268f52ccb46 (patch) | |
tree | 7ef37dadc82e5726e249e5677ec0125691581a75 /plugin/zoom-js | |
parent | 713702a0ab81d1756a30e6c14ae49afd42135541 (diff) | |
parent | 97bb6e9b584f6b4eee33c91e04e5a40da358b7cd (diff) |
Merge branch 'dev' of github.com:hakimel/reveal.js
Diffstat (limited to 'plugin/zoom-js')
-rw-r--r-- | plugin/zoom-js/zoom.js | 12 |
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, |