zoom.js works on main wrapper element

edit
Hakim El Hattab 2017-06-19 11:06:58 +02:00
parent 76eea30083
commit b04489b129
1 changed files with 19 additions and 14 deletions

View File

@ -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
});
}
} );
}
})();
/*!