Jquery implements the special page turning effect on the left and right of the keyboard
JQuery implements the code for turning pages of 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 of the website and facilitate visitor paging, thus greatly improving the PV of the website.
The left and right pages of the jquery keyboard are displayed. When there is no previous or next page, pressing the keyboard does not respond, avoiding incorrect jumps.
HTML code
?
| 1 2 |
<P> previous article: <a id = 'pre' href = 'HTTP: // www.daimajiayuan.com/sitejs-17294-1.html'> a page layout that fades around with the scroll bar </a> </p> <P> next article: <a id = 'Next' href = 'HTTP: // www.daimajiayuan.com/sitejs-18339-1.html'> click the check box to add or delete value values to the input box. </a> </p> |
Jquery code
?
| 1 2 3 4 5 6 7 8 9 |
$ (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.