Difference between revisions of "Template:Team:NUS Singapore/JS"

Line 1,672: Line 1,672:
 
})();
 
})();
 
</script>
 
</script>
 +
<script>
 +
function growDiv(param) {
 +
var id = param;
 +
    var growDiv = document.getElementById('grow-'+id);
 +
 +
    if (growDiv.clientHeight) {
 +
      growDiv.style.height = 0;
 +
    } else {
 +
      var items = document.querySelectorAll('#grow-' + id + ' .list-group-item');
 +
if (items.length > 0)
 +
growDiv.style.height = (items.length * items[0].clientHeight) + "px";
 +
    }
 +
 +
    if(document.getElementById("menu-item-"+id).className.indexOf("focus") >= 0){
 +
    document.getElementById("menu-item-"+id).className = document.getElementById("menu-item-"+id).className.replace("focus", "");
 +
    } else{
 +
    document.getElementById("menu-item-"+id).className += " focus";
 +
    }
 +
 +
    event.preventDefault();
 +
}
 +
 +
var $head = $( '#ha-header' );
 +
$( '.ha-waypoint' ).each( function(i) {
 +
var $el = $( this ),
 +
animClassDown = $el.data( 'animateDown' ),
 +
animClassUp = $el.data( 'animateUp' );
 +
 +
$el.waypoint( function( direction ) {
 +
if( !(direction !== 'down' || !animClassDown) ) {
 +
$head.attr('class', 'ha-header ' + animClassDown);
 +
}
 +
else if( !(direction !== 'up' || !animClassUp) ){
 +
$head.attr('class', 'ha-header ' + animClassUp);
 +
}
 +
}, { offset: '100%' } );
 +
} );
 +
 +
(function($) {
 +
 +
var setCss = function() {
 +
if($(window).width() <= 550) {
 +
$('#nus_logo').css('left', "15%");
 +
$('#sci_logo').css('display', "none");
 +
$('#sps_logo').css('display', "none");
 +
$('#igem_logo').css('display', "none");
 +
}else{
 +
$('#nus_logo').css('left', "0%");
 +
$('#sci_logo').css('display', "block");
 +
$('#sps_logo').css('display', "block");
 +
$('#igem_logo').css('display', "block");
 +
}
 +
};
 +
 +
$(document).ready(function() {
 +
setCss();
 +
$(window).resize(setCss);
 +
});
 +
 +
})(jQuery);
 +
</script>
 +
 +
<script>
 +
 +
$( "#canvas" )
 +
  .mouseleave(function() {
 +
$('#Cancer_cell_body_text').css('display', 'none');
 +
$('#Cancer_cell_body').css('opacity', '1');
 +
 +
  $('#CD44v6_text').css('display', 'none');
 +
  $('#CD44v6').css('opacity', '1');
 +
 +
  $('#Invasin_and_LLO_text').css('display', 'none');
 +
  $('#Invasin_and_LLO').css('opacity', '1');
 +
 +
  $('#Quorum_Sensing_text').css('display', 'none');
 +
  $('#Quorum_Sensing').css('opacity', '1');
 +
 +
});
 +
 +
 +
$( "div.CD44v6" )
 +
  .mouseenter(function() {
 +
  $('#Cancer_cell_body').css('opacity', '0.2');
 +
  $('#Cancer_cell_body_text').css('display', 'none');
 +
  $('#Quorum_Sensing').css('opacity', '0.2');
 +
  $('#Quorum_Sensing_text').css('display', 'none');
 +
  $('#Invasin_and_LLO').css('opacity', '0.2');
 +
  $('#Invasin_and_LLO_text').css('display', 'none');
 +
 +
  $('#CD44v6').css('opacity', '1');
 +
    $('#CD44v6_text').css('display', 'block');
 +
    $('#CD44v6_text').textillate({ in: {
 +
    effect: 'fadeInUpBig',
 +
    sync: true
 +
    } });
 +
  })
 +
  .mouseleave(function() {
 +
  $('#CD44v6_text').css('display', 'none');
 +
  $('.CD44v6_text').textillate('start');
 +
});
 +
 +
 +
  $( "div.Cancer_cell_body" )
 +
  .mouseenter(function() {
 +
  $('#CD44v6_text').css('display', 'none');
 +
    $('#CD44v6').css('opacity', '0.2');
 +
  $('#Quorum_Sensing').css('opacity', '0.2');
 +
  $('#Quorum_Sensing_text').css('display', 'none');
 +
  $('#Invasin_and_LLO').css('opacity', '0.2');
 +
  $('#Invasin_and_LLO_text').css('display', 'none');
 +
 +
 +
    $('#Cancer_cell_body_text').css('display', 'block');
 +
    $('#Cancer_cell_body').css('opacity', '1');
 +
    $('#Cancer_cell_body_text').textillate({ in: {
 +
    effect: 'fadeInRightBig',
 +
    sync: true
 +
    } });
 +
  })
 +
  .mouseleave(function() {
 +
  $('#Cancer_cell_body_text').css('display', 'none');
 +
  $('#Cancer_cell_body_text').textillate('start');
 +
});
 +
 +
 +
  $( "div.Invasin_and_LLO" )
 +
  .mouseenter(function() {
 +
  $('#CD44v6_text').css('display', 'none');
 +
    $('#CD44v6').css('opacity', '0.2');
 +
  $('#Cancer_cell_body').css('opacity', '0.2');
 +
  $('#Cancer_cell_body_text').css('display', 'none');
 +
  $('#Quorum_Sensing').css('opacity', '0.2');
 +
  $('#Quorum_Sensing_text').css('display', 'none');
 +
   
 +
 +
    $('#Invasin_and_LLO_text').css('display', 'block');
 +
    $('#Invasin_and_LLO').css('opacity', '1');
 +
    $('#Invasin_and_LLO_text').textillate({ in: {
 +
    effect: 'fadeInDownBig',
 +
    sync: true
 +
    } });
 +
  })
 +
  .mouseleave(function() {
 +
  $('#Invasin_and_LLO_text').css('display', 'none');
 +
  $('#Invasin_and_LLO_text').textillate('start');
 +
});
 +
 +
 +
  $( "div.Quorum_Sensing" )
 +
  .mouseenter(function() {
 +
  $('#CD44v6_text').css('display', 'none');
 +
    $('#CD44v6').css('opacity', '0.2');
 +
  $('#Cancer_cell_body').css('opacity', '0.2');
 +
  $('#Cancer_cell_body_text').css('display', 'none');
 +
  $('#Invasin_and_LLO').css('opacity', '0.2');
 +
  $('#Invasin_and_LLO_text').css('display', 'none');
 +
   
 +
 +
    $('#Quorum_Sensing_text').css('display', 'block');
 +
    $('#Quorum_Sensing').css('opacity', '1');
 +
    $('#Quorum_Sensing_text').textillate({ in: {
 +
    effect: 'fadeInLeftBig',
 +
    sync: true
 +
    } });
 +
  })
 +
  .mouseleave(function() {
 +
  $('#Quorum_Sensing_text').css('display', 'none');
 +
  $('#Quorum_Sensing_text').textillate('start');
 +
});
 +
 +
// $('#CD44v6').mouseenter(function() {
 +
  // $('#CD44v6').css('display', 'none');
 +
// });
 +
// $( "#CD44v6" ).mouseleave(function() {
 +
  // $('#CD44v6').css('display', 'block');
 +
// });
 +
</script>
 +
<!-- text animation-->
 +
<link rel="stylesheet" type="text/css" href="css/animate.css" />
 +
<script src="js/jquery.textillate.js"></script>
 +
<script src="js/jquery.lettering.js"></script>
 +
<!-- end of text animation-->
 +
               
 +
                <!-- and operator -->
 +
<script>
 +
var andop = function (a, b) {
 +
        if (a) {
 +
          if (b) {
 +
            return true;
 +
          } else {
 +
            return false;
 +
          }
 +
        } else {
 +
          return false;
 +
                }
 +
              };
 +
</script>
 
</html>
 
</html>

Revision as of 12:57, 4 October 2016