Permalink
Browse files

left and right keys now navigate through projects.

  • Loading branch information...
1 parent 2bf5c10 commit 9999f546572354f09194c688141cbe59522c6b77 @samanpwbb committed Dec 21, 2012
Showing with 43 additions and 2 deletions.
  1. +43 −2 js/site.js
View
@@ -22,14 +22,14 @@ $(document).ready(function(){
if (t > bottom ) {
$nxt.parent().addClass('inactive')
- .removeAttr('href');
+ $pre.removeAttr('href');
} else {
$nxt.parent().removeClass('inactive')
};
if (pg < 3 ) {
$pre.parent().addClass('inactive')
- .removeAttr('href');
+ $pre.removeAttr('href');
} else {
$pre.parent().removeClass('inactive');
};
@@ -49,4 +49,45 @@ $(document).ready(function(){
return false;
});
+ // Keybindings
+
+$("a[href]").click(function(event)
+{
+ var link = $(this);
+ var target = link.attr("target");
+
+ if($.trim(target).length > 0)
+ {
+ window.open(link.attr("href"), target);
+ }
+ else
+ {
+ window.location = link.attr("href");
+ }
+ event.preventDefault();
+});
+
+$(document).keydown(function(e){
+ switch(e.which) {
+ case 37: // left
+ $('.master .prev a').trigger('click');
+ break;
+
+ // case 38: // up
+ // $('.onpage .prev a').trigger('click');
+ // break;
+
+ case 39: // right
+ $('.master .next a').trigger('click');
+ break;
+
+ // case 40: // down
+ // $('.onpage .next a').trigger('click');
+ // break;
+
+ default: return; // exit this handler for other keys
+ }
+ e.preventDefault();
+});
+
});

0 comments on commit 9999f54

Please sign in to comment.