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

(Undo revision 162598 by Chloroplast (talk))
Line 1,293: Line 1,293:
 
}).call(this);
 
}).call(this);
 
</script>
 
</script>
 
 
<script>
 
function growDiv(param) {
 
var id = param;
 
    var growDiv = document.getElementById('grow-'+id);
 
    if (growDiv.clientHeight) {
 
      growDiv.style.height = 0;
 
    } else {
 
      var wrapper = document.querySelector('.measuringWrapper-'+id);
 
      growDiv.style.height = wrapper.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>
 
 
 
</html>
 
</html>

Revision as of 03:07, 4 October 2016