Animated scroll to top with .goUp()

.goUp()


Description: Add an animated scroll to top button on your web page with BitsyCode.


Example:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>goUp demo</title>
      <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
    </head>
    <body>
      
      
      //Add content here to see code in action
      
      <script type="text/javascript">
         
         bitsyCode.ready(function(){
            bitsyCode.goUp();
         });
         
      </script>
     
    </body>
    </html>

Preview:

Scroll to view the demo at the bottom right of this page.

  • Usage

    • How to use:

      Adds a scroll to top button on your web page, with customizable options.

    • Simple:

      bitsyCode.ready(function(){ //Check if document is ready
          bitsyCode.goUp();
      });
    • Customizable:

      bitsyCode.ready(function(){ //Check if document is ready
          bitsyCode.goUp({ speed:"slow", classStyle:"myClass", content:"top", position:"top" });
      });
  • Options

    • What options are there:
      speed: 'fast' (default value) // Specify the speed of scroll, either fast or slow
      classStyle: '' (default value) // Specify a custom class name for the button container.
      content: '⇡' (default value) // Specify text ot HTML entities to be displayed in button.
      position: 'bottom' (default value) // Set the position of the button.
  • Returns

    • Returns: No return type

      This method does not need to return any type.

Share