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