Team:NCTU Formosa/source/head

From 2013.igem.org

(Difference between revisions)
Line 79: Line 79:
   }     
   }     
});
});
 +
/*
$.fn.followTo = function (pos) {
$.fn.followTo = function (pos) {
     var $this = this,
     var $this = this,
Line 101: Line 102:
$('#toc').followTo(431);
$('#toc').followTo(431);
});
});
 +
*/
 +
    var $sidebar  = $("#toc"),
 +
        $window    = $(window),
 +
        offset    = $sidebar.offset(),
 +
        topPadding = 431;
 +
 +
    $window.scroll(function() {
 +
        if ($window.scrollTop() > offset.top+topPadding) {
 +
            $sidebar.addClass('fixed');
 +
        } else {
 +
            $sidebar.removeClass('fixed');
 +
        }
 +
    });
</script>
</script>

Revision as of 14:23, 31 August 2013