Skip to content

Add section links #5

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

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Change name to section-links and added pointer effect
  • Loading branch information
BenCuff committed Sep 3, 2024
commit e2acc2979b191554fb8a4cd88711f7e8098e363c
2 changes: 1 addition & 1 deletion docs/_layouts/guidance-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<!--Scripts-->
<script src="assets/scripts/expandable-sections.js"></script>
<script src="assets/scripts/permalinks.js" defer></script>
<script src="assets/scripts/section-links.js" defer></script>

</head>
<body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Function to copy link to clipboard
function copylink(text) {
navigator.clipboard.writeText(text).then(() => {
alert(`Link copied to clipboard: ${text}`);
alert(`Link copied to clipboard:\n${text}`);
}).catch(err => {
console.error('Failed to copy link', err);
});
Expand All @@ -16,8 +16,8 @@ document.querySelectorAll('h1, h2, h3, h4, h5').forEach(heading => {

// Create the icon element
const iconWrapper = document.createElement('span');
iconWrapper.className = 'permalink';
iconWrapper.title = 'Permalink';
iconWrapper.className = 'section-link';
iconWrapper.title = 'Section link';
iconWrapper.innerHTML = ' ';

// Append the icon to the heading
Expand Down
9 changes: 6 additions & 3 deletions docs/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ ul, ol{
}


/*Permalinks*/
.permalink{
/*Section links*/
.section-link{
background-image: url('img/permalink.png');
width: 18px;
height: 18px;
Expand All @@ -154,6 +154,10 @@ ul, ol{
background-size: cover;
}

.section-link:hover{
cursor: pointer;
}

h1 span, h2 span, h3 span, h4 span, h5 span {
transition: opacity 0.3s ease-in-out;
}
Expand All @@ -163,7 +167,6 @@ h1:hover span, h2:hover span, h3:hover span, h4:hover span, h5:hover span{
}



/*Fancy elements*/
blockquote{
margin: 1em 0 2em 0;
Expand Down