Difference between revisions of "Template:Freiburg/MenubarTest"
Line 490: | Line 490: | ||
</script> | </script> | ||
+ | <script> | ||
+ | /*Attachable menu code*/ | ||
+ | $( document ).ready(function() { | ||
+ | //overwrite css | ||
+ | $("#header").css('position','fixed'); | ||
+ | $("#header").css('width','100%'); | ||
+ | $("#page-content").css('margin-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> | ||
<!------------- END: jQuery -------------> | <!------------- END: jQuery -------------> | ||
Revision as of 16:08, 10 September 2015