Team:UCLA/Template/Javascript test

From 2014.igem.org

(Difference between revisions)
(Blanked the page)
 
Line 1: Line 1:
-
<html>
 
-
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
 
-
<!--TOP NAVIGATION MENU BAR-->
 
-
<script type="text/javascript">
 
-
$(document).ready(function() {
 
-
$("#menu > li > ul").hide();
 
-
$("#menu > li").mouseenter(function() {
 
-
$(this).children("li > ul").slideDown(500);
 
-
});
 
-
        $("#menu > li").mouseleave(function() {
 
-
$(this).children("li > ul").slideUp(500);
 
-
});
 
-
});
 
-
</script>
 
-
 
-
 
-
<!--SIDE SPIDER ANIMATION-->
 
-
<script type="text/javascript">
 
-
//rotator - delay, children
 
-
(function( $ ){
 
-
$.fn.rotator = function(delay, time, child){
 
-
//set curImage val
 
-
var currImg = 0;
 
-
var currIt = true;
 
-
//set array of images
 
-
var ss = $(this).children(child);
 
-
var ssize = ss.size();
 
-
var startTime = new Date().getTime();
 
-
var interval = setInterval(function() {
 
-
if(currIt){
 
-
$(ss[currImg]).css('opacity','1');
 
-
currIt = !currIt;
 
-
}else if (!currIt){
 
-
                $(ss[currImg]).css('opacity','0');
 
-
$(ss[currImg+1]).css('opacity','1');
 
-
currIt = !currIt;
 
-
currImg++;
 
-
}
 
-
//reset
 
-
if(currImg >= ssize){
 
-
currImg = 0;
 
-
$(ss[currImg]).css('opacity','1');
 
-
}
 
-
if(new Date().getTime() - startTime > time){
 
-
clearInterval(interval);
 
-
return;
 
-
}
 
-
}, delay);
 
-
return this;
 
-
};
 
-
})(jQuery);
 
-
 
-
 
-
$(document).ready(function(){
 
-
$(document).keydown(function(e) {
 
-
if(e.keyCode == 40){
 
-
$("#spider").rotator(55, 1000, 'img');
 
-
$("#spider").animate({
 
-
"top": "+=100px"
 
-
}, 1000);
 
-
} else if(e.keyCode == 38){
 
-
$("#spider").rotator(55, 1000, 'img');
 
-
$("#spider").animate({
 
-
"top": "-=100px"
 
-
}, 1000);
 
-
}
 
-
});
 
-
});
 
-
</script>
 
-
 
-
 
-
</html>
 

Latest revision as of 15:57, 27 August 2014