Template:Team:TU Munich/LabHeader
From 2012.igem.org
(Difference between revisions)
m |
|||
Line 179: | Line 179: | ||
$('h1 span.mw-headline').attr({ onMouseOver: "this.style.cursor='pointer'"}) | $('h1 span.mw-headline').attr({ onMouseOver: "this.style.cursor='pointer'"}) | ||
- | + | var top = $('#labselect').offset().top - parseFloat($('#labselect').css('marginTop').replace(/auto/, 0)); | |
+ | $(window).scroll(function (event) { | ||
+ | // what the y position of the scroll is | ||
+ | var y = $(this).scrollTop(); | ||
+ | |||
+ | // whether that's below the form | ||
+ | if (y >= top) { | ||
+ | // if so, ad the fixed class | ||
+ | $('#labselect').addClass('fixed'); | ||
+ | } else { | ||
+ | // otherwise remove it | ||
+ | $('#labselect').removeClass('fixed'); | ||
+ | } | ||
+ | }); | ||
}); | }); |
Revision as of 14:34, 12 August 2012