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.