Team:UCLA/Template/Javascript

From 2014.igem.org

(Difference between revisions)
Line 54: Line 54:
$(document).ready(function(){
$(document).ready(function(){
-
$("#down").click(function() {
+
$(document).keydown(function(e) {
-
$("#spider").rotator(55, 1000, 'img');
+
if(e.keyCode == 40){
-
$("#spider").animate({
+
$("#spider").rotator(55, 1000, 'img');
-
"top": "+=100px"
+
$("#spider").animate({
-
}, 1000);
+
"top": "+=100px"
-
});
+
}, 1000);
-
$("#up").click(function() {
+
} else if(e.keyCode == 38){
-
$("#spider").rotator(55, 1000, 'img');
+
$("#spider").rotator(55, 1000, 'img');
-
$("#spider").animate({
+
$("#spider").animate({
-
"top": "-=100px"
+
"top": "-=100px"
-
}, 1000);
+
}, 1000);
 +
}
});
});
});
});

Revision as of 00:31, 20 July 2014