Back to top Button

Hey, you can do that today with a bit of Javascript:

var topP = document.createElement("p");
topP.style.textAlign = "center";
topP.innerHTML = '<a href="#">Back to top</a>';
var cont = document.getElementById("wrapper");
if (cont !== null) {
    // Add to blog index and tag pages
    cont.appendChild(topP);
} else {
    // Add to individual blog post page
    cont = document.getElementById("post-body");
    cont.insertAdjacentHTML("afterend", topP.outerHTML);
}
3 Likes