Team:UCLA/Template/Javascript

From 2014.igem.org

(Difference between revisions)
 
(23 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
-
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
+
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
 +
<!--SPIDER TOP BUTTON-->
 +
<script type="text/javascript">
 +
jQuery(document).ready(function($){
 +
    $('.spiderbutton, .backtotop').click(function(){
 +
          $('.spiderbutton').stop(true,true).animate({ top: '-=55%'}, 800, function(){$('.spiderbutton').stop(true,true).animate({ top: '+=55%'}, 3000)});
 +
          $('.spiderline').stop(true,true).animate({ top: '-=55%'}, 800, function(){$('.spiderline').stop(true,true).animate({ top: '+=55%'}, 3000)});
 +
          $("html, body").animate({ scrollTop: 0 }, 1000);
 +
    });
 +
});
 +
</script>
 +
 
 +
 
 +
<!--SPLASH PAGE-->
 +
<script type="text/javascript">
 +
    $(document).ready(function() {
 +
        $('#box1').hover(function(){
 +
            var smallTop = $('#box1').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
        $('#box2').hover(function(){
 +
            var smallTop = $('#box2').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
                $('#box3').hover(function(){
 +
            var smallTop = $('#box3').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
                $('#box4').hover(function(){
 +
            var smallTop = $('#box4').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
    });
 +
</script>
 +
 
 +
<!--MAIN PAGE BOXES-->
 +
<script type="text/javascript">
 +
    $(document).ready(function() {
 +
        $('#box5').hover(function(){
 +
            var smallTop = $('#box5').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
        $('#box6').hover(function(){
 +
            var smallTop = $('#box6').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
                $('#box7').hover(function(){
 +
            var smallTop = $('#box7').height() - $(".cover", this).height() -10 +"px";
 +
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 +
}, function() {
 +
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 +
});
 +
    });
 +
</script>
 +
 
 +
 
 +
<!--SIDE NAVIGATION MENU BAR-->
 +
<script type="text/javascript">
 +
$(document).ready(function(){
 +
  $("#side_menu").mouseenter(function(){
 +
    $("#side_menu").stop(true,false).animate({
 +
      left:'0px',
 +
    });
 +
  }).mouseleave(function(){
 +
    $("#side_menu").stop(true,false).animate({
 +
      left:'-170px',
 +
    });
 +
  });
 +
});
 +
</script>
<!--TOP NAVIGATION MENU BAR-->
<!--TOP NAVIGATION MENU BAR-->
Line 7: Line 88:
$("#menu > li > ul").hide();
$("#menu > li > ul").hide();
$("#menu > li").mouseenter(function() {
$("#menu > li").mouseenter(function() {
-
$(this).children("li > ul").slideDown(500);
+
$(this).children("li > ul").stop(true,true).slideDown(350);
});
});
         $("#menu > li").mouseleave(function() {
         $("#menu > li").mouseleave(function() {
-
$(this).children("li > ul").slideUp(500);
+
$(this).children("li > ul").stop(true,true).slideUp(350);
});
});
});
});
Line 51: Line 132:
};
};
})(jQuery);
})(jQuery);
-
 
$(document).ready(function(){
$(document).ready(function(){
Line 69: Line 149:
});
});
</script>
</script>
 +
 +
<!--SLIDER-->
<!--SLIDER-->
-
<script type="text/javascript">
 
-
function Slider(){
 
-
($(".slider #1").show("fade",500);
 
-
$(".slider #1").delay(3000).hide("slide",{direction:'left'},500);
 
-
 
-
var sc = $(".slider img").size();
 
-
var count = 2;
 
-
 
-
setInterval(function(){
 
-
$(".slider #"+count).show("slide",{direction:'right'},500);
 
-
$(".slider #"+count).delay(3000).hide("slide",{direction:'left'},500);
 
-
if(count == sc){
 
-
count = 1;
 
-
}else{
 
-
count += 1;
 
-
}
 
-
},4000);
 
-
}
 
-
</script>
 
-
 
-
<!--CAROUSEL-->
 
<script type="text/javascript">
<script type="text/javascript">
   $(document).ready(function() {
   $(document).ready(function() {
-
    $('.carousel').carousel({
+
    $('.slider_left').mouseenter(function(){
-
      interval: 8000
+
          $('.slider_left').animate({ opacity: '0.8'},1);
-
    })
+
    });
 +
    $('.slider_right').mouseenter(function(){
 +
          $('.slider_right').animate({ opacity: '0.8'},1);
 +
    });
 +
    $('.slider_left').mouseleave(function(){
 +
          $('.slider_left').animate({ opacity: '0.5'},1);
 +
    });
 +
    $('.slider_right').mouseleave(function(){
 +
          $('.slider_right').animate({ opacity: '0.5'},1);
 +
    });
 +
 
 +
 
 +
    var total = $('.slider_imgs > td').length;
 +
    var count = 0;
 +
    $('.slider_left').click(function(){
 +
        if(count > 0){
 +
            $('.slider_imgs').stop(true,true).animate({ left: '+=1150px'}, 250);
 +
            count -= 1;
 +
        } else{
 +
            $('.slider_imgs').stop(true,true).animate({ left: '+=20px'}, 100, function(){$('.slider_imgs').stop(true,true).animate({ left: '-=20px'}, 500)});
 +
        }
 +
    });
 +
    $('.slider_right').click(function(){
 +
        if(count < 3){
 +
            $('.slider_imgs').stop(true,true).animate({ left: '-=1150px'}, 250);
 +
            count += 1;
 +
        } else{
 +
            $('.slider_imgs').stop(true,true).animate({ left: '+=3450px'}, 250);
 +
            count = 0;
 +
        }
 +
    });
   });
   });
</script>
</script>
-
<!--BACK TO TOP BUTTON-->
+
 
 +
<!--HP SLIDER-->
<script type="text/javascript">
<script type="text/javascript">
-
$(function(){
+
  $(document).ready(function() {
-
$(document).on( 'scroll', function(){
+
    $('.hpslider_left').mouseenter(function(){
-
if ($(window).scrollTop() > 100) {
+
          $('.hpslider_left').animate({ opacity: '0.8'},1);
-
$('.scroll-top-wrapper').addClass('show');
+
    });
-
} else {
+
    $('.hpslider_right').mouseenter(function(){
-
$('.scroll-top-wrapper').removeClass('show');
+
          $('.hpslider_right').animate({ opacity: '0.8'},1);
-
}
+
    });
-
});
+
    $('.hpslider_left').mouseleave(function(){
-
$('.scroll-top-wrapper').on('click', scrollToTop);
+
          $('.hpslider_left').animate({ opacity: '0.5'},1);
-
});
+
    });
-
+
    $('.hpslider_right').mouseleave(function(){
-
function scrollToTop() {
+
          $('.hpslider_right').animate({ opacity: '0.5'},1);
-
verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;
+
    });
-
element = $('body');
+
-
offset = element.offset();
+
-
offsetTop = offset.top;
+
-
$('html, body').animate({scrollTop: offsetTop},700, 'swing');
+
-
};
+
-
$(".scroll").click(function(event){
+
    var total = $('.hpslider_imgs > td').length;
-
event.preventDefault();
+
    var count = 0;
-
//calculate destination place
+
    $('.hpslider_left').click(function(){
-
var dest=0;
+
        if(count > 0){
-
if($(this.hash).offset().top > $(document).height()-$(window).height()){
+
            $('.hpslider_imgs').stop(true,true).animate({ left: '+=1150px'}, 250);
-
dest=$(document).height()-$(window).height();
+
            count -= 1;
-
}else{
+
        } else{
-
dest=$(this.hash).offset().top;
+
            $('.hpslider_imgs').stop(true,true).animate({ left: '-=16100px'}, 250);
-
}
+
            count = 14;
-
//go to destination
+
//            $('.hpslider_imgs').stop(true,true).animate({ left: '+=20px'}, 100, function(){$('.hpslider_imgs').stop(true,true).animate({ left: '-=20px'}, 500)});
-
$('html,body').animate({scrollTop:dest}, 700,'swing');
+
        }
-
});
+
    });
 +
    $('.hpslider_right').click(function(){
 +
        if(count < 14){
 +
            $('.hpslider_imgs').stop(true,true).animate({ left: '-=1150px'}, 250);
 +
            count += 1;
 +
        } else{
 +
            $('.hpslider_imgs').stop(true,true).animate({ left: '+=16100px'}, 250);
 +
            count = 0;
 +
        }
 +
    });
 +
  });
</script>
</script>
-
<!--SPIDER-->
 
-
<script type="text/javascript">
 
-
var mouseY = 0;
 
-
$(document).mousemove(function(e){
 
-
  mouseY = e.pageY;
 
-
});
 
-
// cache the selector
 
-
var follower = $("#follower");
 
-
var yp = 0;
 
-
var loop = setInterval(function(){
 
-
    // change 12 to alter damping higher is slower
 
-
    yp += (mouseY - yp) / 12;
 
-
    follower.css({top:yp});
 
-
   
 
-
}, 30);
 
-
</script>
 
-
<!--SPLASH PAGE-->
 
-
<script type="text/javascript">
 
-
    $(document).ready(function() {
 
-
        $('#box1').hover(function(){
 
-
            var smallTop = $('#box1').height() - $(".cover", this).height() -10 +"px";
 
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 
-
}, function() {
 
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 
-
});
 
-
        $('#box2').hover(function(){
 
-
            var smallTop = $('#box2').height() - $(".cover", this).height() -10 +"px";
 
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 
-
}, function() {
 
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 
-
});
 
-
                $('#box3').hover(function(){
 
-
            var smallTop = $('#box3').height() - $(".cover", this).height() -10 +"px";
 
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 
-
}, function() {
 
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 
-
});
 
-
                $('#box4').hover(function(){
 
-
            var smallTop = $('#box4').height() - $(".cover", this).height() -10 +"px";
 
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
 
-
}, function() {
 
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
 
-
});
 
-
    });
 
-
</script>
 
-
<!--MAIN PAGE BOXES-->
+
<!--PAGE HEADERS-->
<script type="text/javascript">
<script type="text/javascript">
-
    $(document).ready(function() {
+
$(document).ready(function() {
-
        $('#box5').hover(function(){
+
    $('.page_header_box').mouseenter(function(){
-
            var smallTop = $('#box5').height() - $(".cover", this).height() -10 +"px";
+
          $(this).animate({ opacity: '0.9'},1);
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
+
    });
-
}, function() {
+
    $('.page_header_box').mouseleave(function(){
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
+
          $(this).animate({ opacity: '0.5'},1);
-
});
+
    });
-
        $('#box6').hover(function(){
+
});
-
            var smallTop = $('#box6').height() - $(".cover", this).height() -10 +"px";
+
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
+
-
}, function() {
+
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
+
-
});
+
-
                $('#box7').hover(function(){
+
-
            var smallTop = $('#box7').height() - $(".cover", this).height() -10 +"px";
+
-
    $(".cover", this).stop().animate({top:smallTop},{queue:false,duration:160});
+
-
}, function() {
+
-
    $(".cover", this).stop().animate({top:'340px'},{queue:false,duration:160});
+
-
});
+
-
    });
+
</script>
</script>
 +
</html>
</html>

Latest revision as of 02:45, 18 October 2014