Template:Team:Calgary Entrepreneurial/Header

From 2013.igem.org

(Difference between revisions)
Line 14: Line 14:
<script>
<script>
 +
//from http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
 +
function viewport() {
 +
    var e = window, a = 'inner';
 +
    if (!('innerWidth' in window )) {
 +
        a = 'client';
 +
        e = document.documentElement || document.body;
 +
    }
 +
    return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
 +
}
 +
$(document).ready(function(){
$(document).ready(function(){
//only activates if JS is active: removes the notice
//only activates if JS is active: removes the notice
Line 20: Line 30:
//only activates if JS is active: changes z-index of the maincontent box to
//only activates if JS is active: changes z-index of the maincontent box to
//go over the blackheader instead of the default value (2)
//go over the blackheader instead of the default value (2)
-
if($(window).width() > 768){
+
if(viewport().width > 768){
$('#maincontent').css('z-index', '3');
$('#maincontent').css('z-index', '3');
}
}
Line 36: Line 46:
$(window).scroll(function(){
$(window).scroll(function(){
-
if($(window).width() > 768){
+
if(viewport().width > 768){
//fades in the white header when the white portion hits the top
//fades in the white header when the white portion hits the top
if(window.pageYOffset > pos.top){
if(window.pageYOffset > pos.top){

Revision as of 00:31, 24 October 2013

FREDsense's website works best with Javascript enabled, especially on mobile devices. Please enable Javascript for optimal viewing.