- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2021 08:15 PM
Hi,
I want to add SC Scroll to top widget in the portal.
How can I add?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2021 08:57 PM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2021 08:57 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2021 02:44 AM
HI Anirudh
I had used the same Code , i got the button in homepage but not Working
As the button need to scroll up its not working
Is there any changes need to done
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2021 08:31 AM
You have to add spUtil in the main controller function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 02:50 AM
Example of adding spUtil in the main controller function?