Difference between revisions of "Template:Freiburg/MenubarTest"
Line 383: | Line 383: | ||
<!------------- BEGIN: jQuery -------------> | <!------------- BEGIN: jQuery -------------> | ||
− | + | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
$(function() { | $(function() { | ||
Line 490: | Line 490: | ||
}) | }) | ||
</script> | </script> | ||
+ | <script> | ||
+ | /*Attachable menu code*/ | ||
+ | $( document ).ready(function() { | ||
+ | |||
+ | $(window).scroll(function (event) { | ||
+ | var y = $(this).scrollTop(); | ||
+ | console.log(y); | ||
+ | if(y>61){ | ||
+ | $("#header").css('position','fixed'); | ||
+ | $("#header").css('width','100%'); | ||
+ | $("#header").css('margin-top','-61'); | ||
+ | $("#bottom-arrow").css('display','none'); | ||
+ | $("#runningchip-back").css('display','none'); | ||
+ | $("#navtext").css('margin-top','-20'); | ||
+ | |||
+ | |||
+ | }else{ | ||
+ | // $("#header").removeAttr('style'); | ||
+ | |||
+ | |||
+ | $("#header").css('margin-top','-'+y); | ||
+ | $("#bottom-arrow").removeAttr('style'); | ||
+ | $("#runningchip-back").removeAttr('style'); | ||
+ | $("#navtext").removeAttr('style'); | ||
+ | |||
+ | } | ||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | }); | ||
+ | |||
+ | </script> | ||
<!------------- END: jQuery -------------> | <!------------- END: jQuery -------------> | ||
Revision as of 23:12, 9 September 2015