Team:Cornell/sandbox
From 2013.igem.org
(Difference between revisions)
Line 333: | Line 333: | ||
return $.trim($(this).html()) == ''; | return $.trim($(this).html()) == ''; | ||
}).remove(); | }).remove(); | ||
- | + | ||
$(document).keydown(function(e){ | $(document).keydown(function(e){ | ||
- | + | //down or right | |
- | + | if (e.which == 40 || e.which == 39) { | |
- | $( | + | if(parseInt($("#second-last-screen").css('left')) > -1) //only scroll if we haven't reached the far right |
+ | scroll($(".parallax, .screen"), 0); | ||
+ | |||
+ | return false; //prevent more keydown events from firing | ||
+ | } | ||
+ | |||
+ | //up or left | ||
+ | else if(e.which == 38 || e.which == 37) { | ||
+ | if(parseInt($("#first-screen").css('left')) < 0) //only scroll if we haven't reached the far left | ||
+ | scroll($(".parallax, .screen"), 1); | ||
+ | |||
+ | return false; //prevent more keydown events from firing | ||
+ | } | ||
}); | }); | ||
}); | }); | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
function scroll(param, dir) { | function scroll(param, dir) { | ||
$(param).each(function() { | $(param).each(function() { |
Revision as of 20:37, 1 January 2014