Documentation v8.0.15

Overview

ScrollTop is an exclusive component of Metronic  that provides a simple build-in solution for a scroll to top button implementation. All CSS and JS requirements are bundled globally by default.

Usage

ScrollTop's script bundles are globally included in all pages.
<link href="assets/css/style.bundle.css" rel="stylesheet" type="text/css"/>
<script src="assets/js/scripts.bundle.js"></script>

Initialization

  • ScrollTop's CSS and Javascript files are globally initialized and added into our script bundle.
  • Add .scrolltopcss class and data-kt-scrolltop="true"to a HTML element to enable it.
  • ScrollTop instances can also be controlled programmatically. See below for more info.

Basic Example

Add .scrolltopcss class data-kt-scrolltop="true"to any element element to enable it. However, it's best to be used with an icon as the child element.
The .scrolltopcss class adds all necessary styling to the scrolltop element. Adding additional Bootstrap classes to scrolltop will also work accordingly to override the default css styling.
The ScrollTop component demo can be found at the lower right corner of the browser or click the button below to scroll to the top.
Click herefor more info on the options.
Tip: To add scroll top functionality to a stand-alone button or any other HTML element, add data-kt-scrolltop="true"only.
Scroll to top
<!--begin::Scrolltop button-->
<div id="kt_docs_example_basic" class="btn btn-primary" data-kt-scrolltop="true">
    Scroll to top
</div>
<!--end::Scrolltop button-->

Markup Reference

Scrolltop uses HTML attributes to define the scrolltop configuration. Here are the references for each below
HTML Attribute references
Name Type Description
data-kt-scrolltop mandatory Enables the element as a scrolltop. Accepts trueor falsevalues.
data-kt-scrolltop-offset optional Defines the offset value in pxbefore the ScrollTop components comes into effect when scrolling from the top of the page. The pxstring is not required for this value. For example: data-kt-scrolltop-offset="300".
data-kt-scrolltop-speed optional Defines the scrolling speed when scrolltop is clicked. Accepts a number value in ms. For example: data-kt-scrolltop-speed="600"will define that it will take about 0.6 seconds to scroll to the top of the page when clicked.

Methods

All scrolltop components are initialized automatically, however the following are ScrollTop's functionality methods for more control.
Name Description
Static Methods
getInstance(DOMElement element) Get the Toggle instance created
var scrollTopElement = document.querySelector("#kt_scrolltop_control");
var scrollTop = KTScrolltop.getInstance(scrollTopElement);
Public Methods
KTScrolltop(DOMElement element, Object options) Constructs a new instance of KTScrolltopclass and initializes a Drawer control:
var scrollElement = document.querySelector("#kt_scrolltop_control");
var scrollTop = new KTScrolltop(scrollElement, {offset: 300, speed: 600});
Remove data-kt-scrolltop="true"attribute to avoid lazy initialization. Options offsetand speedreplicate data-kt-scrolltop-offsetand data-kt-scrolltop-speedoptions functionaliy as described above.
go Triggers the ScrollTop function. If there is room to scroll to top, this will trigger scrolltop to start scrolling to the top of the page.
scrollTop.go();
getElement Returns the scrollTop element.
scrollTop.getElement();

Activity Logs

There are 2 new tasks for you in “AirPlus Mobile APp” project:
Added at 4:23 PM by
img
Meeting with customer
Application Design
img
img
A
In Progress
View
Project Delivery Preparation
CRM System Development
img
B
Completed
View
Invitation for crafting engaging designs that speak human workshop
Sent at 4:23 PM by
img
Task #45890merged with #45890in “Ads Pro Admin Dashboard project:
Initiated at 4:23 PM by
img
3 new application design concepts added:
Created at 4:23 PM by
img
New case #67890is assigned to you in Multi-platform Database Design project
Added at 4:23 PM by
Alice Tan
You have received a new order:
Placed at 5:05 AM by
img

Database Backup Process Completed!

Login into Metronic Admin Dashboard to make sure the data integrity is OK
Proceed
New order #67890is placed for Workshow Planning & Budget Estimation
Placed at 4:23 PM by
Jimmy Bold
Pic
Brian Cox 2 mins
How likely are you to recommend our company to your friends and family ?
5 mins You
Pic
Hey there, we’re just writing to let you know that you’ve been subscribed to a repository on GitHub.
Pic
Brian Cox 1 Hour
Ok, Understood!
2 Hours You
Pic
You’ll receive notifications for all issues, pull requests!
Pic
Brian Cox 3 Hours
You can unwatch this repository immediately by clicking here: Keenthemes.com
4 Hours You
Pic
Most purchased Business courses during this sale!
Pic
Brian Cox 5 Hours
Company BBQ to celebrate the last quater achievements and goals. Food and drinks provided
Just now You
Pic
Pic
Brian Cox Just now
Right before vacation season we have the next Big Deal for you.

Explore Metronic

Demo1

Demo2

Demo3

demo
Coming soon

Demo4

demo
Coming soon

Demo5

Demo6

demo
Coming soon

Demo7

demo
Coming soon

Demo8

demo
Coming soon

Demo9

demo
Coming soon

Demo10

demo
Coming soon

Demo11

demo
Coming soon

Demo12

demo
Coming soon

Demo13

demo
Coming soon

Demo14

demo
Coming soon

Demo15

demo
Coming soon