Team:Groningen/Template/SCRIPTS/scrollmenu
From 2014.igem.org
(Difference between revisions)
(3 intermediate revisions not shown) | |||
Line 2: | Line 2: | ||
$(document).ready(function () { | $(document).ready(function () { | ||
var menuIconsHeight = $('.default .module.menu .item .icon').height(); | var menuIconsHeight = $('.default .module.menu .item .icon').height(); | ||
- | |||
$(window).scroll(function(){ | $(window).scroll(function(){ | ||
if( $(window).scrollTop() > menuIconsHeight) { | if( $(window).scrollTop() > menuIconsHeight) { | ||
- | + | $('.module.menu .content').css({position: 'fixed', top: '-100pt'}); | |
- | + | $('.module.menu .content').css({'left': 0 - $(document).scrollLeft() }); | |
- | $(' | + | |
- | $(' | + | |
- | + | ||
} else { | } else { | ||
- | $(' | + | $('.module.menu .content').css({position: 'relative', top: '0', left:'0'}); |
} | } | ||
}) | }) | ||
}); | }); | ||
</html> | </html> |
Latest revision as of 13:28, 17 October 2014
$(document).ready(function () { var menuIconsHeight = $('.default .module.menu .item .icon').height(); $(window).scroll(function(){ if( $(window).scrollTop() > menuIconsHeight) { $('.module.menu .content').css({position: 'fixed', top: '-100pt'}); $('.module.menu .content').css({'left': 0 - $(document).scrollLeft() }); } else { $('.module.menu .content').css({position: 'relative', top: '0', left:'0'}); } }) });