JQuery implements the code for turning the left and right arrow keys on the keyboard on the webpage. we often see this effect in many novel websites, which can improve the user experience and facilitate visitor paging, this greatly improves the page flip function of the PV jquery keyboard on the left and right, and the jquery keyboard direction key on the page. when there is no previous or next article, pressing the keyboard will not respond, avoiding incorrect jump.
HTML code
Previous article: a page layout that gradually fades along with the scroll bar
Next: click the check box to add or delete the value to the input box.
Jquery code
$ (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 ;});});
The above is all the content of this article. I hope you will like it.