Tired of scrolling back up when you've hit the bottom of your blog?
Here is a quick guide on how to add a cute, floating scroll-to-top button to your Tumblr theme. It fades in when you scroll down and glides smoothly back to the top when clicked!
The best part? You only need to copy and paste one thing.
The Step-by-Step
Go to Edit Appearance > Edit Theme > Edit HTML.
Click inside the code box and press Ctrl+F (or Cmd+F on Mac).
Search for (it is usually at the very bottom).
Paste the code below right before the tag.
Update Preview and Save!
The Code
(Copy everything in this box!)
<style> /* --- THE STYLING --- */ #scrollToTopBtn { position: fixed; bottom: 30px; right: 30px; z-index: 999999; /* Sits on top of everything */ border: none; outline: none; background-color: {color:Post Background}; /* Matches your post color */ cursor: pointer; padding: 12px; border-radius: 50%; opacity: 0; /* Hidden by default */ pointer-events: none; transition: opacity 0.4s, transform 0.2s; box-shadow: 0 4px 15px rgba(0,0,0,0.15); border: 1px solid {color:Borders}; } #scrollToTopBtn.show { opacity: 1; pointer-events: auto; } #scrollToTopBtn:hover { transform: translateY(-5px); /* Cute hop effect */ } /* The Icon Settings */ #scrollToTopBtn img { width: 20px; /* Size of the icon */ height: auto; display: block; /* filter: invert(1); <--- UNCOMMENT THIS LINE if you need a white icon! */ } </style> <div id="scrollToTopBtn" onclick="scrollToTop()"> <img src="https://static.tumblr.com/obptcxj/p59mo0l0s/pin.png" alt="Scroll to Top"> </div> <script> var mybutton = document.getElementById("scrollToTopBtn"); // Show button when scrolling down 100px window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { mybutton.classList.add("show"); } else { mybutton.classList.remove("show"); } } // Smooth scroll to top function function scrollToTop() { window.scrollTo({top: 0, behavior: 'smooth'}); } </script>
How to Customize
Change the Icon: Look for the line that starts with <img src="…. Replace the URL inside the quotes with any image URL you like!
Change the Color: If your icon is black but your theme is dark, find /* filter: invert(1); … / in the CSS section and remove the / and */ to turn the icon white.
Change the Position: In the CSS section, change bottom: 30px; or right: 30px; to move it around.
It would look super cute on your blog… and even cuter if you tagged me in the caption. Just saying. 👀
Also, there are some time that the cursor will change when you hover it over the links. Copy and paste the code over your links section also. It would look something like this a{ or a:hover{
Now, here's the surprising part. If you want to change the image of your cursor, use this code instead:
cursor: url(URL IMAGE OF YOUR CURSOR), auto;
Then, look for any cursor image you want it to be then copy and paste the link to the "URL IMAGE OF YOUR CURSOR", in between the parentheses. The URL should start with https:// for it to work. You may try searching at google or Pinterest with the cursor you want and change the url to it.
Now, if you want to change it. Go to your CSS, or find this in your HTML <style> / <style type=css""> and copy paste the code above.
::-webkit-scrollbar { (THIS IS FOR STYLE OF THE SCROLLBAR ITSELF)
width: 10px; (HOW THICK YOU WANT IT TO BE)
background: #000000; (THE BACKGROUND OF THE SCROLLBAR)
}
::-webkit-scrollbar-thumb {
background: #458eff; (THE COLOR OF THE SCROLLBAR)
border-radius: 5px; (HOW CIRCLE YOU WANT YOUR SCROLLBAR TO LOOK LIKE)
}
You can use this website for the color codes.
Disclaimer: The code is not mine, I just heavily tweaked it from the owner.
You may change the colors of it using this website.
::selection {
color: {color:background}; (THIS IS FOR THE COLOR OF THE TEXT WHILE SELECTING IT)
background: {color:text}; (THIS IS FOR THE BACKGROUND WHILE SELECTING IT)
}
Disclaimer: This code is not included on the theme I am currently using and that I have tweaked it so it can conveniently help you in editing your blog.
how did you get your sidebar image to change everytime you clicked a new tab? sorry to bother just always wanted to do it but im clueless with technology
I used THIS tutorial. It took me forever to get it to work though, but only because one of my quotation marks was Word-formatted, and it needed to be html-formatted. Once I got that straightened out, though, it was pretty easy.