up and down keys for navigation

This commit is contained in:
Sanj 2011-07-01 22:10:55 +05:30
parent 9ce083275b
commit 64d262ff77

View File

@ -80,6 +80,17 @@ $(function() {
}, "json");
});
$(document).keydown(function(e) {
var k = e.keyCode;
if (k==40) {
e.preventDefault();
moveListDown();
}
if (k==38) {
e.preventDefault();
moveListUp();
}
});
$(window).resize(function() {
var minuser = 400;
@ -179,3 +190,19 @@ function getSelectedIds() {
});
return ids;
}
function moveListDown() {
var currentIndex = $('.selectedItem').index(".fileItem");
if (currentIndex == $('.fileItem').length) {
return;
}
$('.fileItem').eq(currentIndex + 1).click();
}
function moveListUp() {
var currentIndex = $('.selectedItem').index(".fileItem");
if (currentIndex == 0) {
return;
}
$('.fileItem').eq(currentIndex - 1).click();
}