2011-11-04 104 views
0

我想在HTML表格中使用標題中的箭頭來隱藏/顯示列以移動數據。用箭頭移動列

按左邊的箭頭將顯示左側隱藏欄(例如2011-04月份欄)並隱藏右側欄(例如2011-11月份欄)等等。 是這樣的一種jQuery腳本,還是我必須嘗試做我自己的腳本?

回答

0
$(document).keydown(function(e){ 
     switch (e.keyCode) { 
      case 37: 
       console.log('left'); 
       $("#leftCollumn").show(); 
       $("#rightCollumn").hide(); 
       break; 
      case 38: 
       console.log('up'); 
       break; 
      case 39: 
       console.log('right'); 
       $("#leftCollumn").hide(); 
       $("#rightCollumn").show(); 
       break; 
      case 40: 
       console.log('down'); 
       break; 
      default: 
       console.log('all others'); 
      }  
    });