how to get the arrow keys on the keyboard to trigger navigation (previous/next page) links within a blog

后端 未结 2 1340
醉梦人生
醉梦人生 2021-02-01 23:42

the script i\'ve pieced together so far looks like this:



        
2条回答
  •  南方客
    南方客 (楼主)
    2021-02-02 00:29

    Use this to tell you the keyIdentifier attribute of the object.

    
    
    
    
    
    
    
    
    

    Then you can use if-then logic to ignore all key presses you aren't interested in, and wire the correct behavior to the ones you are.

    The following will assign the left and right arrow keys to your links (based on the id of the anchor/link elements).

    
    
    
    
    
    
    
    

    Google Yahoo

提交回复
热议问题