Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub pages style sheet #35

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions _includes/head-custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- start custom head snippets, customize with your own _includes/head-custom.html file -->

<!-- Setup Google Analytics -->
{% include head-custom-google-analytics.html %}

<!-- You can set your favicon here -->
<!-- link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.ico' | relative_url }}" -->
<script>
function toggleWidth() {
if (document.querySelector("div.container-lg").style["max-width"]) {
document.querySelector("div.container-lg").style.maxWidth = null;
document.querySelector("button[name='toggle-table-width']").textContent = "Expand table";
} else {
document.querySelector("div.container-lg").style.maxWidth = "100%";
document.querySelector("button[name='toggle-table-width']").textContent = "Collapse table";
}
}
document.addEventListener("DOMContentLoaded", function(event) {
var el = document.querySelector('table');
var wrapper = document.createElement('div');
wrapper.setAttribute("id", "comparison-table");
el.parentNode.insertBefore(wrapper, el);
wrapper.appendChild(el);
document.getElementById("comparison-table").insertAdjacentHTML( 'beforebegin', '<button name="toggle-table-width" onclick="toggleWidth()">Expand table</button>' );
});
</script>
<!-- end custom head snippets -->
38 changes: 38 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
---

@import "{{ site.theme }}";

div#comparison-table {
max-height: 75vh;
overflow: auto;
}

table {
display: table !important;
text-align: left;
position: relative;
}

th {
background: white;
position: sticky;
top: 0;
z-index: 2;
}

th:first-child {
left: 0;
z-index: 3;
}

td:first-child {
background: white;
position: sticky;
left: 0;
z-index: 1;
}

div.container-lg > h1:nth-child(1) {
display: none;
}