Skip to content

Commit

Permalink
commented code so it's easier to read
Browse files Browse the repository at this point in the history
  • Loading branch information
slri committed Jul 25, 2018
1 parent 07daeec commit ec32013
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,17 @@ $(document).ready(function() {
});
}

/**
* If the user scrolls or presses arrow keys, the event is triggered.
*
*/
$("#work").on("mousewheel DOMMouseScroll keydown", function(event) {

if(!sPActive) {
if(!sPActive) { //if skewed pages aren't revealed, don't react to this event.
return;
}

if(scrolling) {
if(scrolling) { //if the scrolling animation is active, don't react to this event.
event.preventDefault();
return;
}
Expand All @@ -101,6 +105,10 @@ $(document).ready(function() {
}
});

/**
* Go one skewed page up/back or down/forward.
*
*/
function navigateUp(event) {
if(currentWorkPage - 1 >= 0) {
scrolling = true;
Expand All @@ -114,7 +122,6 @@ $(document).ready(function() {
}, 500);
}
}

function navigateDown(event) {
if(currentWorkPage + 1 <= numberOfWorkPages) {
scrolling = true;
Expand All @@ -138,25 +145,29 @@ $(document).ready(function() {
determine(event, "#about");
});

// Attempt to make one of those fancy fade-ins
// setTimeout(function() {
// $(".background").css("opacity", "1");
// }, 200);
/**
* Actions triggered by skip and show work area buttons.
*
*/
$("#show-work").click(function(event) {
determine(event, this.hash);
sPActive = true;

$(this).css("opacity", 0);
$(".skew-pages_overlay").css("background", "transparent");
$("#work").focus();

setTimeout(function() {
$(".skew-pages_overlay").css("z-index", "9900");
}, 500);
});
$(".skip-work").click(function(event) {
determine(event, this.hash);
sPActive = false;

$("#show-work").css("opacity", 1);
$(".skew-pages_overlay").css("background", overlayBg);

setTimeout(function() {
$(".skew-pages_overlay").css("z-index", "9997");
}, 500);
Expand Down

0 comments on commit ec32013

Please sign in to comment.