knowledge

DibyaJyotiD7656
Giga Contributor

There is no direct redirection to the top of the KBA , user need to scroll up . this will be a challenge for bigger KBAs with multiple topics.

 

Include “Go to top icon” in KBA page for easy navigation to the start of the Knowledge article

1 ACCEPTED SOLUTION

dbook
Kilo Sage

I would suggest taking advantage of the Anchor (1) and Insert/Edit Link (2) features available in the HTML Editor. 

dbook_0-1752069114616.png

 

Anchor: This allow you to declare a specific location within the HTML Field, think if this as a bookmark. 

Inset/Edit Link: Once Anchors have been declared, you can choose to link to an Anchor rather than a URL. 

 

dbook_1-1752069237330.png

 

You could take this a step further by setting up templates with predefined 'Back to the Top' type links. 

 

Hope this helps! 

 

View solution in original post

7 REPLIES 7

GlideFather
Tera Patron

Hi @DibyaJyotiD7656,

I don't have answer for developing that icon but I wouldn't recommend that.

This is not worthy to develop anything, because that would require a lot of customisations...

  • they can just use the scroll bar on the right side of their browser,
  • refresh the page and it will get them, back on the top,
  • use a keyboard shortcut (on mac cmd+arrow up, on windows I am not sure).
———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


I found this article for moving to bottom, so you just adjust for up, something like:
function scrollToTop() {
document.documentElement.scrollTop = 0;
}

But it is not tested and not guaranteed it will not bring problems...

https://www.servicenow.com/community/servicenow-ai-platform-forum/scroll-automatically-to-the-bottom...

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi KamilT,

 

I used UI Script For this and it's working but Go To Top Button has show in Context_workflow.do

 

Hear is the script:

addLoadEvent(function() {
    if (typeof g_form != 'undefined' && g_form.getTableName() != 'kb_knowledge') {
        return; // Run only on KB articles
    }
    var goTopBtn = document.createElement("button");
    goTopBtn.innerHTML = "Go To Top↑";
goTopBtn.id = "goToTopBtn";
goTopBtn.style.position = "fixed";
goTopBtn.style.bottom = "30px";
goTopBtn.style.right = "30px";
goTopBtn.style.padding = "10px 15px";
goTopBtn.style.background = "#0072C6";
goTopBtn.style.color = "white";
goTopBtn.style.border = "none";
goTopBtn.style.borderRadius = "5px";
goTopBtn.style.cursor = "pointer";
goTopBtn.style.zIndex = "9999";
goTopBtn.style.display = "none";
 
    document.body.appendChild(goTopBtn);
 
    window.onscroll = function() {
        if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
goTopBtn.style.display = "block";
        } else {
goTopBtn.style.display = "none";
        }
    };
 
    goTopBtn.addEventListener("click", function() {
        window.scrollTo({ top: 0, behavior: 'smooth' });
    });
});
 
I want it only shows in ITIL view. 

And only for KB Articles.