jquery implementation by Keyboard direction key page effect

Source: Internet
Author: User

This article to share is the use of jquery to achieve the key to the keyboard to flip the effect of the page, the code is very simple, functional very practical, here recommended to everyone, I hope you can enjoy.

1.jQuery Code:

The code is as follows:
$ (document). Ready (function () {
var prevpage=$ ("#pre"). attr ("href");
var nextpage=$ ("#next"). attr ("href");
$ ("Body"). KeyDown (function (event) {
if (event.keycode==37 && prevpage!=undefined) location=prevpage;
if (event.keycode==39 && nextpage!=undefined) location=nextpage;
});
});

2.Html Code:

The code is as follows:
<p>
On an article:
<a id= ' pre ' href= ' http://www.jb51.net/sitejs-17294-1.html ' > a page layout with the scroll bar sliding around </a>
</p>
<p>
Next article:
<a id= ' Next ' href= ' http://www.jb51.net/sitejs-18339-1.html ' > click checkbox to add or remove value values into input box </a>
</p>

Remember to introduce jquery file Oh, well here is not much nonsense, I hope this article can learn jquery help.

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.