aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhakimel <hakim.elhattab@gmail.com>2012-10-09 09:22:16 -0400
committerhakimel <hakim.elhattab@gmail.com>2012-10-09 09:22:16 -0400
commit16b71d7a218909a0c5cd70a7e303c601a6f015fa (patch)
tree100e027201fe59a70d21a7aac7a781aa9dd94b1f
parent7166e2d8cc4639d204927a7289fde8b79bd59410 (diff)
downloadperl-software-in-gnu-guix-16b71d7a218909a0c5cd70a7e303c601a6f015fa.tar
perl-software-in-gnu-guix-16b71d7a218909a0c5cd70a7e303c601a6f015fa.tar.gz
slight tweak to zoom integration
-rw-r--r--index.html4
-rw-r--r--plugin/zoom-js/zoom.js (renamed from lib/js/zoom.js)37
2 files changed, 14 insertions, 27 deletions
diff --git a/index.html b/index.html
index 5606025..34ada2c 100644
--- a/index.html
+++ b/index.html
@@ -92,7 +92,7 @@
<section>
<h2>Point of View</h2>
<p>
- Press <strong>ESC</strong> to enter the slide overview. Hold down alt and click on any element to zoom in on it using <a href="http://lab.hakim.se/zoom-js">zoom.js</a>.
+ Press <strong>ESC</strong> to enter the slide overview. Hold down alt and click on any element to zoom in on it using <a href="http://lab.hakim.se/zoom-js">zoom.js</a>. Alt + click anywhere to zoom back out.
</p>
</section>
@@ -342,7 +342,7 @@ function linkify( selector ) {
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
- { src: 'lib/js/zoom.js', condition: function() { return !!document.body.classList; } },
+ { src: 'plugin/zoom-js/zoom.js', condition: function() { return !!document.body.classList; } },
{ src: '/socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } }
]
diff --git a/lib/js/zoom.js b/plugin/zoom-js/zoom.js
index 7fba523..0ca3875 100644
--- a/lib/js/zoom.js
+++ b/plugin/zoom-js/zoom.js
@@ -1,3 +1,13 @@
+// Custom reveal.js integration
+(function(){
+ document.querySelector( '.reveal' ).addEventListener( 'click', function( event ) {
+ if( event.altKey ) {
+ event.preventDefault();
+ zoom.to({ element: event.target, pan: false });
+ }
+ } );
+})();
+
/*!
* zoom.js 0.2 (modified version for use with reveal.js)
* http://lab.hakim.se/zoom-js
@@ -41,7 +51,7 @@ var zoom = (function(){
if( level !== 1 && event.keyCode === 27 ) {
zoom.out();
}
- } );
+ }, false );
// Monitor mouse movement for panning
document.addEventListener( 'mousemove', function( event ) {
@@ -49,7 +59,7 @@ var zoom = (function(){
mouseX = event.clientX;
mouseY = event.clientY;
}
- } );
+ }, false );
/**
* Applies the CSS required to zoom in, prioritizes use of CSS3
@@ -232,26 +242,3 @@ var zoom = (function(){
})();
-
-
-
-// Custom reveal.js integration
-(function(){
- var modifierIsActive = false;
-
- function updateKeyFlag( event ) {
- modifierIsActive = event.altKey;
- }
-
- document.addEventListener( 'keypress', updateKeyFlag, false );
- document.addEventListener( 'keydown', updateKeyFlag, false );
- document.addEventListener( 'keyup', updateKeyFlag, false );
-
- document.querySelector( '.reveal' ).addEventListener( 'click', function( event ) {
- if( modifierIsActive ) {
- event.preventDefault();
- zoom.to({ element: event.target, pan: false });
- }
- } );
-})();
-