Created
January 12, 2010 22:28
-
-
Save elliottkember/275695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
if($.browser.safari){ | |
height = parseInt($('#wrapper').css('height')); | |
number = height / 100; | |
for(i=0;i<number;i++){ | |
$("<a name="+i+"></a>").css('position','absolute').css('top', i*100+'px').appendTo($('body')); | |
} | |
} | |
}) | |
if($.browser.safari){ | |
var key_counter = 0; | |
$(document).keydown(function(e) { | |
old_key_counter = key_counter; | |
if(e.keyCode == 40){ | |
key_counter += 1; | |
} | |
if(e.keyCode == 38){ | |
key_counter -= 1; | |
} | |
if ( e.keyCode == 32 ){ | |
if( e.shiftKey == 1 ){ | |
key_counter -= 4; | |
}else{ | |
key_counter += 4; | |
} | |
} | |
if(key_counter < 0){ | |
key_counter = 0; | |
} | |
if ((key_counter+6) * 100 >= parseInt($('#wrapper').css('height'))){ | |
key_counter = old_key_counter; | |
} | |
document.location.hash = key_counter; | |
setTimeout(function(){ | |
window.location.hash = ""; | |
}, 0) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment