-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript for next and back.js
executable file
·34 lines (29 loc) · 1.23 KB
/
script for next and back.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Here You can type your custom JavaScript...
(function ($) {
$(document).ready(function() {
let searchParams = new URLSearchParams(window.location.search);
searchParams.has('PersonID');
let PersonID = searchParams.get('PersonID');
$('.box-primary.box-body').append('<a class="btn btn-app prev-member" role="button" href="/PersonView.php?PersonID='+(parseInt(PersonID) -1)+'"><i class="fa fa-chevron-left"></i> PREVIOUS MEMBER</a>')
$('.box-primary.box-body').append('<a class="btn btn-app next-member" role="button" href="/PersonView.php?PersonID='+(parseInt(PersonID) + 1)+'"><i class="fa fa-chevron-right"></i> NEXT MEMBER</a>')
let href_goto = '';
$(document).keydown(function(e) {
switch(e.which) {
case 37: // left
href_goto = $('.prev-member').attr('href');
window.location = href_goto;
break;
case 38: // up
break;
case 39: // right
href_goto = $('.next-member').attr('href');
window.location = href_goto;
break;
case 40: // down
break;
default: return; // exit this handler for other keys
}
e.preventDefault();
});
});
})(jQuery);