|
| 1 | +<head> |
| 2 | + <meta charset="utf-8"> |
| 3 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 4 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 5 | + |
| 6 | + <title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title> |
| 7 | + <meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}"> |
| 8 | + |
| 9 | + <link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}"> |
| 10 | + <link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}"> |
| 11 | + <link rel="alternate" type="application/atom+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" /> |
| 12 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> |
| 13 | + <script src="/js/sticky.js"></script> |
| 14 | + <script> |
| 15 | + var headlines = []; |
| 16 | + $(function() { |
| 17 | + $(".outline").stick_in_parent({offset_top:30}); |
| 18 | + $('a[name]').each(function() { |
| 19 | + headlines.push({el: $(this), top:$(this).offset().top}); |
| 20 | + }); |
| 21 | + |
| 22 | + var selectHeadline = function() { |
| 23 | + if (headlines.length) { |
| 24 | + var top = $(window).scrollTop(); |
| 25 | + var headline = headlines[0].el; |
| 26 | + for(var i=0;i<headlines.length;i++) { |
| 27 | + if (headlines[i].top <= top + 30) { |
| 28 | + headline = headlines[i].el; |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | + var el = $("a[href='#" + headline.attr('name') + "']"); |
| 33 | + if (!el.hasClass('selected')) { |
| 34 | + $('a[href^=#].selected').removeClass('selected'); |
| 35 | + el.addClass('selected'); |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + $(window).on('scroll', selectHeadline); |
| 41 | + selectHeadline(); |
| 42 | + }); |
| 43 | + |
| 44 | + $(document).on('click', 'a[href^=#]', function(e) { |
| 45 | + var tag = $(e.currentTarget).attr('href').replace(/^#/, ''); |
| 46 | + var el = $("a[name='" + tag + "']"); |
| 47 | + $('html,body').animate({scrollTop: el.offset().top-30}); |
| 48 | + return false; |
| 49 | + }); |
| 50 | + |
| 51 | + $(document).on('click', '.hamburger', function() { |
| 52 | + $('.hamburger, nav').toggleClass('open'); |
| 53 | + }) |
| 54 | + </script> |
| 55 | + |
| 56 | +</head> |
0 commit comments