Skip to content

Commit

Permalink
Extra shortcuts: <home> to the first slide, <end> to the last slide (…
Browse files Browse the repository at this point in the history
…overview)
  • Loading branch information
dwiash committed Jan 23, 2012
1 parent 88a5996 commit 0a5b187
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,25 @@
return select(next);
};

var selectHome = function () {
return select(steps[0]);
};

var selectEnd = function () {
return select(steps[steps.length-1]);
};

// EVENTS

document.addEventListener("keydown", function ( event ) {
if ( event.keyCode == 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
if ( event.keyCode == 9 || ( event.keyCode >= 32 && event.keyCode <= 40) ) {
switch( event.keyCode ) {
case 35: ; // end
selectEnd();
break;
case 36: ; // home
selectHome();
break;
case 33: ; // pg up
case 37: ; // left
case 38: // up
Expand Down

0 comments on commit 0a5b187

Please sign in to comment.