How to add a SC Scroll to top widget in portal

Gopal14
Tera Contributor

Hi,

 

I want to add SC Scroll to top widget in the portal. 

How can I add?

@Aman Singh @Anil Lande @Ankur Bawiskar @Mark Roethof 

@Mark Stanger 

1 ACCEPTED SOLUTION

AnirudhKumar
Mega Sage
Mega Sage

The OOB SC Scroll to top widget works only on mobile devices.

I've stolen parts of the code to make it work for all devices.

 

Create a new widget and add below components:

HTML:

<button class="btn fa fa-arrow-up fa-lg padder-lg button-to-top pull-right" ng-click="goToTop()" ></button>

 

Client  Controller:(Note: In your client controller, add spUtil as parameter to the main function)

$scope.goToTop= function()
	{
		spUtil.scrollTo('.sp-scroll', 300);
	}

 

CSS:

.button-to-top {
    position: fixed;
    bottom: 0;
    right: 0;
    margin-right: 15px;
    margin-bottom: 15px;
    border-radius: 5px !important;
    opacity: 0.7 !important;
    padding: 12px !important;
    border: 1px solid !important;
    width: 47px;
    height: 45px;
    background-color: #ddd;
  }

 

Add this widget to your page, and your functionality should be ready.

 

 

Long Live ServiceNow!

View solution in original post

5 REPLIES 5

In case you still need an answer, just add it like this.

sago45_0-1728031037143.png