Keyboard control div Move up or down (go)

Source: Internet
Author: User

<html> > <title></title> <link rel= "stylesheet" type= "text/css" href= " Public/easy_ui/themes/icon.css "> <script type= "Text/javascript" src= "Public/easy_ui/jquery.min.js"> </Script> <script type= "Text/javascript" src= "Public/easy_ui/easy_ Ui.min.js "></script> <script type= "Text/javascript" src= "Public/easy_ui/easyloader.js"> </Script> > <body> <div id="div" style= "Background-color: red; width: 400px ; height: 300px; left: 100px; top: 100px; " > </div> </body> <script> $ (function() { $ (document). KeyDown (function (event) { var keycode = event.keycode; var space =; var div = $ (' #div '); Switch (keycode) { Case 37:div.offset ({left: (Div.offset (). left-20)}); Break ; Case 38:div.offset ({top: (Div.offset (). top-20)}); Break ; Case 39:div.offset ({left: (Div.offset (). Left + 20)}); Break ; Case 40:div.offset ({top: (Div.offset (). Top + 20)}); Break ; default: Break; } });});</script> > http://www.cnblogs.com/cglWorkBook/p/5134698.html

Keyboard control div Move up or down (go)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.