Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated keypress switch case to include shift + spacebar to scroll up #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions jquery.onepage-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,28 +391,40 @@
var tag = e.target.tagName.toLowerCase();

if (!$("body").hasClass("disabled-onepage-scroll")) {
switch(e.which) {
case 38:
var isShift;
if(window.event) {
key = window.event.keyCode;
isShift = !!window.event.shiftKey;
} else {
key = ev.which;
isShift = !!ev.shiftKey;
}

switch(true) {
case key = 38:
if (tag != 'input' && tag != 'textarea') el.moveUp()
break;
case 40:
break;
case key = 40:
if (tag != 'input' && tag != 'textarea') el.moveDown()
break;
case 32: //spacebar
break;
case key = 32 && isShift:
if (tag != 'input' && tag != 'textarea') el.moveUp();
break;
case key = 32 && !isShift: //spacebar
if (tag != 'input' && tag != 'textarea') el.moveDown()
break;
case 33: //pageg up
break;
case key = 33: //pageg up
if (tag != 'input' && tag != 'textarea') el.moveUp()
break;
case 34: //page dwn
break;
case key = 34: //page dwn
if (tag != 'input' && tag != 'textarea') el.moveDown()
break;
case 36: //home
break;
case key = 36: //home
el.moveTo(1);
break;
case 35: //end
break;
case key = 35: //end
el.moveTo(total);
break;
break;
default: return;
}
}
Expand Down