Team:UCLA/Template/Javascript

From 2014.igem.org

(Difference between revisions)
Line 91: Line 91:
</script>
</script>
-
<!--CAROUSEL-->
+
<!--SPIDER TOP BUTTON-->
<script type="text/javascript">
<script type="text/javascript">
-
  $(document).ready(function() {
+
jQuery(document).ready(function($){
-
    $('.carousel').carousel({
+
    $('.spiderbutton').click(function(){
-
      interval: 8000
+
          $("html, body").animate({ scrollTop: 0 }, 500);
-
    })
+
          $('.spiderbutton').animate({ top: '-=90%'}, 800, function(){$('.spiderbutton').animate({ top: '+=90%'}, 3000)});
-
  });
+
          $('.spiderline').animate({ top: '-=90%'}, 800, function(){$('.spiderline').animate({ top: '+=90%'}, 3000)});
-
</script>
+
    });
-
 
+
-
<!--BACK TO TOP BUTTON-->
+
-
<script type="text/javascript">
+
-
$(function(){
+
-
$(document).on( 'scroll', function(){
+
-
if ($(window).scrollTop() > 100) {
+
-
$('.scroll-top-wrapper').addClass('show');
+
-
} else {
+
-
$('.scroll-top-wrapper').removeClass('show');
+
-
}
+
-
});
+
-
$('.scroll-top-wrapper').on('click', scrollToTop);
+
-
});
+
-
+
-
function scrollToTop() {
+
-
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){
+
-
event.preventDefault();
+
-
//calculate destination place
+
-
var dest=0;
+
-
if($(this.hash).offset().top > $(document).height()-$(window).height()){
+
-
dest=$(document).height()-$(window).height();
+
-
}else{
+
-
dest=$(this.hash).offset().top;
+
-
}
+
-
//go to destination
+
-
$('html,body').animate({scrollTop:dest}, 700,'swing');
+
});
});
-
</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>
</script>
Line 207: Line 155:
     });
     });
</script>
</script>
 +
 +
<!--SIDE NAVIGATION MENU BAR-->
 +
<script type="text/javascript">
 +
$(document).ready(function(){
 +
  $("#side_menu").mouseenter(function(){
 +
    $("#side_menu").animate({
 +
      left:'0px',
 +
    });
 +
  }).mouseleave(function(){
 +
    $("#side_menu").animate({
 +
      left:'-110px',
 +
    });
 +
  });
 +
});
 +
</script>
 +
 +
<!--TOP NAVIGATION MENU BAR-->
 +
<script type="text/javascript">
 +
$(document).ready(function() {
 +
$("#menu > li > ul").hide();
 +
$("#menu > li").mouseenter(function() {
 +
$(this).children("li > ul").stop(true,true).slideDown(350);
 +
});
 +
        $("#menu > li").mouseleave(function() {
 +
$(this).children("li > ul").stop(true,true).slideUp(350);
 +
});
 +
});
 +
</script>
 +
</html>
</html>

Revision as of 22:13, 15 September 2014