Hello!
Is there any way to add a “back-to-top” button or text to the blog?
I think it would be handy…
Hello!
Is there any way to add a “back-to-top” button or text to the blog?
I think it would be handy…
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);
}
Nice, that worked!
Is there a way to add utf-8 encoding to replace the text with Greek translation?
I tried to do it and I only got question mark symbols.
Awesome!
I might have to make some changes on our end to get Greek text working. Could you send me an example URL or the exact JS you’re using (either privately, or on this thread)? Then I can make the changes and verify that they work.
Sure! The code I want to use it this one - nothing weird, I just translated the “Back to top” text.
var topP = document.createElement("p");
topP.style.textAlign = "center";
topP.innerHTML = '<a href="#">Επιστροφή στην κορυφή</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);
}
Ah, yep, looks like it was an issue with how we were storing Javascript in the database. This is fixed – if you re-save the JS just like that it should work now
It worked fine, thanks a lot!