Skip to content

Commit

Permalink
Merge pull request #37 from tomanistor/full-nav-no-scroll
Browse files Browse the repository at this point in the history
Fixed issue #36, Moved scripts
  • Loading branch information
tomanistor authored Mar 7, 2018
2 parents 164a8af + 27ca06e commit 12c8175
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 15 deletions.
1 change: 1 addition & 0 deletions layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ <h1>404!</h1>

</main>
{{ partial "footer.html" . }}
{{ partial "body-bottom" . }}
</body>
</html>
1 change: 1 addition & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>

</main>
{{ partial "footer.html" . }}
{{ partial "body-bottom" . }}
</body>
</html>
1 change: 1 addition & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ <h1>{{ if .Params.heading }} {{ .Params.heading }} {{ else }} {{ .Title }} {{ en

</main>
{{ partial "footer.html" . }}
{{ partial "body-bottom" . }}
</body>
</html>
1 change: 1 addition & 0 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@

</main>
{{ partial "footer.html" . }}
{{ partial "body-bottom" . }}
</body>
</html>
11 changes: 11 additions & 0 deletions layouts/partials/body-bottom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ if .IsHome }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "index.js" }}{{ else }}index.min.js{{ end }}" type="text/javascript"></script>
{{ if .Site.Params.ajaxFormspree }}
<script>
{{ partial "scripts/contact.min.js" . | safeJS }}
</script>
{{ end }}
{{ else }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "main.js" }}{{ else }}main.min.js{{ end }}" type="text/javascript"></script>
{{ end }}
13 changes: 0 additions & 13 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,4 @@
</div>
{{ end }}

<!-- Scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ if .IsHome }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "index.js" }}{{ else }}index.min.js{{ end }}" type="text/javascript"></script>
{{ if .Site.Params.ajaxFormspree }}
<script>
{{ partial "scripts/contact.min.js" . | safeJS }}
</script>
{{ end }}
{{ else }}
<script src="/scripts/{{ if .Site.Params.cacheBustJS }}{{ index .Site.Data.cachedAssets "main.js" }}{{ else }}main.min.js{{ end }}" type="text/javascript"></script>
{{ end }}

</footer>
2 changes: 1 addition & 1 deletion static/scripts/index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/scripts/main.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions static/scripts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ var toggle = function(el) {
});
});

// Disable scroll when full screen nav is open
$('body').addEventListener('click', function() {
if ($('.nav-full').classList.contains('active')) {
$('html').style.overflowY = 'hidden';
} else {
$('html').style.overflowY = 'scroll';
}
});

}());

// Mobile browsers viewport height bug fix
Expand Down
9 changes: 9 additions & 0 deletions static/scripts/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ var toggle = function(el) {
});
});

// Disable scroll when full screen nav is open
$('body').addEventListener('click', function() {
if ($('.nav-full').classList.contains('active')) {
$('html').style.overflowY = 'hidden';
} else {
$('html').style.overflowY = 'scroll';
}
});

// Highlight.js initialization
hljs.initHighlightingOnLoad();
}());

0 comments on commit 12c8175

Please sign in to comment.