mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-19 08:24:40 -04:00
Fix toclayout
This commit is contained in:
parent
9764af5be3
commit
7ae01dbb87
@ -1,5 +1,6 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{$title := .Title}}
|
{{$title := .Title}}
|
||||||
|
<span id="page-top"></span>
|
||||||
<main class="main">
|
<main class="main">
|
||||||
{{with .Params.testing }}
|
{{with .Params.testing }}
|
||||||
{{range $ind,$value := . }}
|
{{range $ind,$value := . }}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
{{ if gt .WordCount 500}}
|
{{ if gt .WordCount 300}}
|
||||||
<aside id="toc">
|
<aside id="toc">
|
||||||
<header>
|
<header>
|
||||||
|
<a href="#page-top">
|
||||||
<h3>{{.Title}}</h3>
|
<h3>{{.Title}}</h3>
|
||||||
|
</a>
|
||||||
</header>
|
</header>
|
||||||
{{.TableOfContents}}
|
{{.TableOfContents}}
|
||||||
<a href="#" id="toc-toggle">ToC</a>
|
<a href="#" id="toc-toggle">ToC</a>
|
||||||
|
@ -1,15 +1,24 @@
|
|||||||
$('.body-copy a[href$=".pdf"]').append('<i class="icon-pdf"></i>');
|
|
||||||
$('.body-copy > h2,.body-copy > h3').each(function() {
|
|
||||||
var id = $(this).attr('id'),
|
|
||||||
baseurl = window.location.origin,
|
|
||||||
path = window.location.pathname,
|
|
||||||
fullurl = `${baseurl}${path}#${id}`;
|
|
||||||
$(this).append(`<a class="smooth-scroll heading-link" data-clipboard-text="${fullurl}" href="#${id}"><i class="icon-link"></i></a>`);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('document').ready(function() {
|
$('document').ready(function() {
|
||||||
var cliplink = new Clipboard('.heading-link');
|
$('.body-copy a[href$=".pdf"]').append('<i class="icon-pdf"></i>');
|
||||||
cliplink.on('success', function(e) {
|
$('.body-copy > h2,.body-copy > h3').each(function() {
|
||||||
console.log("hello");
|
var id = $(this).attr('id'),
|
||||||
|
baseurl = window.location.origin,
|
||||||
|
path = window.location.pathname,
|
||||||
|
fullurl = `${baseurl}${path}#${id}`;
|
||||||
|
$(this).append(`<a class="smooth-scroll heading-link" title="Copy heading link to clipboard" data-clip="${fullurl}" href="#${id}"><i class="icon-link"></i></a>`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// const hasCopy = document.execCommand('copy', false, null);
|
||||||
|
// console.log(`${hasCopy} is hasCopy value`);
|
||||||
|
|
||||||
|
window.setTimeout(function() {
|
||||||
|
// let headLinks = document.querySelector('.heading-link');
|
||||||
|
// for (var i = 0; i < headLinks.length; i++) {
|
||||||
|
// headLinks[i].addEventListener('click', copyHeaderLink, false);
|
||||||
|
// }
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
function copyHeaderLink(evt) {
|
||||||
|
let link = evt.target.dataset.clip;
|
||||||
|
console.log(link);
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// bind click event to all internal page anchors
|
// bind click event to all internal page anchors
|
||||||
$('a.heading-link,#TableOfContents a').on('click', function(e) {
|
$('a.heading-link,#toc a').on('click', function(e) {
|
||||||
// prevent default action and bubbling
|
// prevent default action and bubbling
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -16,3 +16,5 @@ $(document).ready(function() {
|
|||||||
location.hash = hashid;
|
location.hash = hashid;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ aside#toc {
|
|||||||
ul li ul {
|
ul li ul {
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
li {
|
li {
|
||||||
|
margin-top:.5em;
|
||||||
a {
|
a {
|
||||||
color: lighten($base-font-color, 25%);
|
color: lighten($base-font-color, 25%);
|
||||||
}
|
}
|
||||||
@ -29,7 +30,7 @@ aside#toc {
|
|||||||
}
|
}
|
||||||
@include MQ(XL) {
|
@include MQ(XL) {
|
||||||
top: $site-header-height + 20px;
|
top: $site-header-height + 20px;
|
||||||
right: 2vw;
|
left: calc(#{$site-navigation-width} + #{$content-max-width} + 3em);
|
||||||
|
|
||||||
}
|
}
|
||||||
@include MQ(HUGE){
|
@include MQ(HUGE){
|
||||||
|
@ -4,7 +4,7 @@ ul.tags {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-top:-1em;
|
margin-top:-1em;
|
||||||
margin-bottom:.5em;
|
margin-bottom:1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags li {
|
.tags li {
|
||||||
|
2
themes/hugodocs/static/css/style.min.css
vendored
2
themes/hugodocs/static/css/style.min.css
vendored
File diff suppressed because one or more lines are too long
6
themes/hugodocs/static/js/script.min.js
vendored
6
themes/hugodocs/static/js/script.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user