Difference between revisions of "Template:ETH Zurich"

m
m
Line 106: Line 106:
 
     });
 
     });
 
   }
 
   }
 +
});
 +
 +
/* Use this to highlight current heading */
 +
$(window).scroll(function(){
 +
/* inspired by http://jsfiddle.net/8n06pvy9/9/ */
 +
 +
var windowPos = $(window).scrollTop();
 +
$('#sideMenu li a[href^="#"]').each(function() {
 +
 +
            var currentLink = $(this);
 +
if ($(currentLink.attr("href")).length > 0)
 +
                {
 +
                var refElement = $(currentLink.attr("href"));
 +
                if (refElement.position().top <= windowPos && (refElement.position().top + refElement.height() + $("#primary-navwrapper").height() ) > windowPos) {
 +
                    $('#sideMenu li a').removeClass("current");
 +
                    currentLink.addClass("current");
 +
                }
 +
                else{
 +
                    currentLink.removeClass("current");
 +
                }
 +
            }
 +
});
 +
 +
 
});
 
});
  
 
</script>
 
</script>
 +
<style>
 +
.current {
 +
text-weight:bold;
 +
}
 +
</style>
  
 
<script type="text/javascript">
 
<script type="text/javascript">

Revision as of 17:51, 19 August 2015

We would like to thank our sponsors