Sha256: dfee409d9c9f570fad108c873cea7eb16bce406a18648a96508ddc6f5c694281
Contents?: true
Size: 882 Bytes
Versions: 17
Compression:
Stored size: 882 Bytes
Contents
// Copy code // Thanks Aleksandr // https://www.aleksandrhovhannisyan.com/blog/how-to-add-a-copy-to-clipboard-button-to-your-jekyll-blog/ const codeBlocks = document.querySelectorAll(".code-header + .highlighter-rouge"); const copyCodeButtons = document.querySelectorAll(".copy-code-button"); copyCodeButtons.forEach((copyCodeButton, index) => { const code = codeBlocks[index].innerText; copyCodeButton.addEventListener("click", () => { window.navigator.clipboard.writeText(code); copyCodeButton.classList.add("copied"); setTimeout(() => { copyCodeButton.classList.remove("copied"); copyCodeButton.blur(); }, 2000); }); }); // Show top page button after scrolling down. $("#topbtn").hide(); $(window).scroll(function() { if ($(window).scrollTop() > 100) { $("#topbtn").fadeIn("slow"); } else { $("#topbtn").fadeOut("fast"); } });
Version data entries
17 entries across 17 versions & 1 rubygems