aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2017-06-19 11:06:58 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2017-06-19 11:06:58 +0200
commitb04489b129210c3160d34023d384f8377ecba552 (patch)
tree5635dd6665f26462657d71194a99ef149fc6b350 /plugin
parent76eea30083b9b0ea4bdfef39c5f04b03bcb647f5 (diff)
downloadperl-software-in-gnu-guix-b04489b129210c3160d34023d384f8377ecba552.tar
perl-software-in-gnu-guix-b04489b129210c3160d34023d384f8377ecba552.tar.gz
zoom.js works on main wrapper element
Diffstat (limited to 'plugin')
-rw-r--r--plugin/zoom-js/zoom.js33
1 files changed, 19 insertions, 14 deletions
diff --git a/plugin/zoom-js/zoom.js b/plugin/zoom-js/zoom.js
index dc5140e..8531790 100644
--- a/plugin/zoom-js/zoom.js
+++ b/plugin/zoom-js/zoom.js
@@ -1,22 +1,27 @@
// Custom reveal.js integration
(function(){
- document.querySelector( '.reveal .slides' ).addEventListener( 'mousedown', function( event ) {
- var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
+ var revealElement = document.querySelector( '.reveal' );
+ if( revealElement ) {
- var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
- var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
+ revealElement.addEventListener( 'mousedown', function( event ) {
+ var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
- if( event[ modifier ] && !Reveal.isOverview() ) {
- event.preventDefault();
+ var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
+ var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
- zoom.to({
- x: event.clientX,
- y: event.clientY,
- scale: zoomLevel,
- pan: false
- });
- }
- } );
+ if( event[ modifier ] && !Reveal.isOverview() ) {
+ event.preventDefault();
+
+ zoom.to({
+ x: event.clientX,
+ y: event.clientY,
+ scale: zoomLevel,
+ pan: false
+ });
+ }
+ } );
+
+ }
})();
/*!