[NODEBB] Scroll Button

Solved Customisation
  • Hi @phenomlab

    I feel like I’ve been abused, but too bad, I’m starting…

    I saw that you had a scroll button that appears/disappears automatically.


    I see this is a JS/CSS/HTML code.

    I also saw that this button does not appear in the topics (probably acting as a duplicate with the existing one one NodeBB). I’m also interested with that element.

    On the other hand it’s very practical in the long page categories for example.

    Is it possible to share this code or not?

    Thanks in advance.

    Good evening!!

  • @downpw Of course it’s possible to share 🙂

    Here’s the CSS

     #btt {
        display: inline-block;
        background: rgba(0, 0, 0, 0.2);
        width: 50px;
        height: 50px;
        text-align: center;
        border-radius: 4px;
        position: fixed;
        bottom: 50px;
        right: 30px;
        transition: background-color .3s, opacity .5s, visibility .5s;
        opacity: 0;
        visibility: hidden;
      #btt.show {
      opacity: 1;
      visibility: visible;
      z-index: 10000;
      color: #ffffff;
    a#btt.show:hover {
      box-shadow: inset 0px 0px 0px 1px #4F707A !important;
      a#btt i {
          position: absolute;
          top: 32%;
          left: 35%;

    Obviously, style to suit your own site

    And here’s the JS

    $(window).on('action:ajaxify.end', function (data) {
        var matched = false;
        var btn = $('#btt');
        var bar = $('.reading-meter');
        $(window).scroll(function () {
            if ($(window).scrollTop() > 300) {
            } else {
            if (window.location.href.indexOf("topic") > -1) {
                if (matched == false) {
                    console.log("This is a topic, so hide the scroll top feature");
                    matched = true;
        btn.on('click', function (e) {
            $('html, body').animate({ scrollTop: 0 }, '300');

    Some points

    bar.addClass('show'); and bar.removeClass('show'); are only required if you are using the progress-meter code. Essentially, the two are designed to work together with the code above, but it won’t matter that much if you aren’t using the progress-meter (however, you may land up with some errors in the console).

  • @phenomlab said in [NODEBB] Scroll Button:

    Some points
    bar.addClass(‘show’); and bar.removeClass(‘show’); are only required if you are using the progress-meter code. Essentially, the two are designed to work together with the code above, but it won’t matter that much if you aren’t using the progress-meter (however, you may land up with some errors in the console).


    You talk about Reading meter bar at the bottom of the navbar isn’ it?

  • @downpw Yes, that’s correct.

  • Ok no problem Sir 😉

  • DownPWundefined DownPW has marked this topic as solved on
  • Add HTML Widget footer 😉

    <a id="btt" class=""><i class="fas fa-chevron-up"></i></a>
  • @downpw ooops. Forgot that. Thanks for adding.

Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation💗

  • 5 Votes
    2 Posts

    Nice. Very good tips Mark 😁

  • 0 Votes
    6 Posts

    @cagatay You should ask in the NodeBB forums. Perhaps reference this post


  • hover link effect

    Solved Customisation
    6 Votes
    18 Posts

    @DownPW Looking at the underlying code, class start is being added on hover by jQuery in this function

    document.querySelectorAll(".button-gradient, .button-transparent").forEach((button) => { const style = getComputedStyle(button); const lines = document.createElement("div"); lines.classList.add("lines"); const groupTop = document.createElement("div"); const groupBottom = document.createElement("div"); const svg = createSVG( button.offsetWidth, button.offsetHeight, parseInt(style.borderRadius, 10) ); groupTop.appendChild(svg); groupTop.appendChild(svg.cloneNode(true)); groupTop.appendChild(svg.cloneNode(true)); groupTop.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); groupBottom.appendChild(svg.cloneNode(true)); lines.appendChild(groupTop); lines.appendChild(groupBottom); button.appendChild(lines); button.addEventListener("pointerenter", () => { button.classList.add("start"); }); svg.addEventListener("animationend", () => { button.classList.remove("start"); }); }); })

    The CSS for start is below

    .button-gradient.start .lines svg, .button-transparent.start .lines svg { animation: stroke 0.3s linear; }

    And this is the corresponding keyframe

    @keyframes stroke { 30%, 55% { opacity: 1; } 100% { stroke-dashoffset: 5; opacity: 0; } }

    It’s using both CSS and SVG, so might not be a simple affair to replicate without the SVG files.

  • Fontawesome 5

    Unsolved Customisation
    1 Votes
    14 Posts

    @pwsincd hi. Just following up on this thread (I know it’s old) but was curious to understand if it’s still an issue or not ?

  • tag icon in front of tags

    Solved Customisation
    3 Votes
    5 Posts

    @phenomlab said in tag icon in front of tags:

    @crazycells Are you using Font Awesome Free ? If so, try this

    span.tag:before { content: "\f02b"; font-family: "Font Awesome 5 Free"; margin-right: 5px; margin-left: 5px; font-weight: 900; }

    yeap, this worked 👍 thanks a lot.

  • 4 Votes
    5 Posts

    @phenomlab thanks 🙏

  • CSS Help on my Flarum

    Solved Customisation
    2 Votes
    5 Posts

    @mike-jones Yes, you’ll typically see this type of behaviour if there is another style that has higher priority in the sense that yours will be overridden. Using !important will override the higher preference, but should be used sparingly rather than everywhere.

  • NodeBB customisation

    Locked Customisation
    27 Votes
    332 Posts

    @jac Given your departure away from your previous project, I’m going to close this thread… 🙂