carsvilla.blogg.se

Random picturebutton code tumblr
Random picturebutton code tumblr







  1. Random picturebutton code tumblr how to#
  2. Random picturebutton code tumblr code#

Then, add that class name into the onclick line as follows: onclick="scrollToTop(document. Ctrl+F each class name if you must and try to find one that no other elements are using in their class=".". If you have only a class="some classes" value on your container (each class is separated by a space), see if you can find the most unique one. When you’re done that line should look something like this: onclick="scrollToTop(document.getElementById('YOUR_ID')", 500) You should see id="value", take that value and replace document.scrollingElement in the onclick line with document.getElementById('INSERT ID VALUE HERE'). If you have an id on your container, awesome, that’s the easiest way to go. You need something with an id or a class that you can reference ( id is easier). The container element will generally be just above / before this token. Oftentimes you’ll see the container element in your theme labelled class="container" or id="posts-container" or something along those lines, but not all theme creators play fair and name it something easy to find! If your theme is a container theme, you need to know some information about the container.

Random picturebutton code tumblr code#

If your theme is not a container theme, you can usually just tell it to scroll the whole page (this is the first example in the code comments) by giving it document.scrollingElement as the thing in the to scroll. You can also try this with logo and such. It means every time you reload the page, the picture will be changed.

Random picturebutton code tumblr how to#

  • How long (in milliseconds) you want it to take to reach the top. This tutorial will teach you on how to change your sidebar images, randomly.
  • random picturebutton code tumblr

    It creates a nice, smooth scrolling animation that can take as long as you like, and you can customize it to scroll the whole page, your post container element, or even just a random little box that holds your likes or something. What exactly it’s supposed to scroll for you. This is a pretty simple lil drag and drop bit of code, and you can stick the button itself pretty much anywhere.You need to provide the scrollToTop() function with two bits of information: If you look at the lines near the bottom, you’ll see an onclick line. If you want to stick it in the corner of your page directly in the element that’s entirely up to you! I’d recommend putting it just inside your sidebar for most themes, but it’s really up to you.

    random picturebutton code tumblr

    It comes in two parts one for the button itself, and one for the styles to make it all pretty however you like! Button Codeįirst, you’ll want to figure out where you want to put your scroll to top button in your theme. It creates a nice, smooth scrolling animation that can take as long as you like, and you can customize it to scroll the whole page, your post container element, or even just a random little box that holds your likes or something.įull disclosure I pulled the original JS code used here from this StackOverflow answer and modified it slightly to be a little easier to drop in place. This is a pretty simple lil drag and drop bit of code, and you can stick the button itself pretty much anywhere. 2 years ago Animated Scroll to Top Button









    Random picturebutton code tumblr