Difference between revisions of "Template:Freiburg/Menubar"
Line 382: | Line 382: | ||
<!------------- BEGIN: jQuery -------------> | <!------------- BEGIN: jQuery -------------> | ||
− | |||
<script type="text/javascript"> | <script type="text/javascript"> | ||
$(function() { | $(function() { | ||
Line 488: | Line 487: | ||
}); | }); | ||
}) | }) | ||
+ | </script> | ||
+ | |||
+ | <script> | ||
+ | /*Attachable menu code*/ | ||
+ | $( document ).ready(function() { | ||
+ | //overwrite css | ||
+ | $("#header").css('position','fixed'); | ||
+ | $("#header").css('width','100%'); | ||
+ | $("#content_background_wrapper").css('padding-top', '100px'); | ||
+ | $("#header").css('margin-top','-25px'); | ||
+ | |||
+ | |||
+ | |||
+ | $(window).scroll(function (event) { | ||
+ | var y = $(this).scrollTop(); | ||
+ | console.log(y); | ||
+ | if(y>60){ | ||
+ | |||
+ | $("#header").css('position','fixed'); | ||
+ | $("#header").css('width','100%'); | ||
+ | $("#header").css('margin-top','-83px'); | ||
+ | $("#bottom-arrow").css('display','none'); | ||
+ | $("#runningchip-back").css('display','none'); | ||
+ | $("#navtext").css('margin-top','-20px'); | ||
+ | }else{ | ||
+ | // $("#header").removeAttr('style'); | ||
+ | |||
+ | var offsetTop = -25-y; | ||
+ | $("#header").css('margin-top',offsetTop+'px'); | ||
+ | $("#bottom-arrow").removeAttr('style'); | ||
+ | $("#runningchip-back").removeAttr('style'); | ||
+ | $("#navtext").removeAttr('style'); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | }); | ||
+ | |||
</script> | </script> | ||
Revision as of 16:22, 10 September 2015