Skip to content

[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.

    4f6552e9-d8ca-4284-adf2-6d0675f3e32c-image.png

    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');
        bar.removeClass('show');
        $(window).scroll(function () {
            if ($(window).scrollTop() > 300) {
                btn.addClass('show');
                bar.addClass('show');
            } else {
                btn.removeClass('show');
                bar.removeClass('show');
            }
            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.removeClass('show');
            }
        });
        btn.on('click', function (e) {
            e.preventDefault();
            $('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).

    @phenomlab

    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 💗

  • 3 Votes
    7 Posts
    328 Views

    @phenomlab yes it’s a different theme. The other one was not offering much on editable sidebar. It was like flarum hahah

  • 5 Votes
    4 Posts
    478 Views

    @DownPW thanks. I forgot about that.

  • Whitespace fixes in Nodebb

    Solved Customisation
    18
    7 Votes
    18 Posts
    767 Views

    @Panda Just circling back here with something of an update (which I think you’ll like). I’ve completely restructured the ranking system. There are now less ranks, with a higher point threshold to reach them.

    More importantly, if you reload the site, you’ll notice that the ranks are now icons.

    I also removed the “Author” badge, and made this a single icon, which (to me) looks much better.

  • Footer bar add center text

    Solved Customisation
    41
    8 Votes
    41 Posts
    3k Views

    @phenomlab said in Footer bar add center text:

    div#console-nav-tab

    Ah ok test with bottom: 0px !important; idem

  • NodeBB Theme/Skin Switcher

    Solved Customisation
    38
    7 Votes
    38 Posts
    2k Views

    @Teemberland great spot ! You should create a PR for that so they can include it in the official repository.

    Just be aware that any subsequent releases will overwrite your fix without the PR.

  • Avatar on Topic Header

    Solved Customisation
    9
    0 Votes
    9 Posts
    524 Views

    @jac said in Avatar on Topic Header:

    @downpw said in Avatar on Topic Header:

    Great Plugin 🙂

    I make it a bit cleaner via this CSS code:

    /*------------------------------------------------------------------*/ /*---------------- nodebb-plugin-browsing-users -----------------*/ /*------------------------------------------------------------------*/ /*Space between the avatar and the RSS icon */ .topic [component="topic/browsing-users"] { margin-bottom: -5px; padding-left: 10px; } /*Space between avatars*/ .pull-left { float: left!important; padding-right: 5px; }

    Do you have a screenshot of how this looks with the CSS change?

    Just added this change, thanks @DownPW 🙂

  • Social icon (Nodebb)

    Solved Customisation
    7
    0 Votes
    7 Posts
    912 Views

    @phenomlab said in Social icon (Nodebb):

    @jac I just tested my theory around using the OG image, and according to the Twitter card validator, it works fine

    73e805e1-997b-41bf-9259-51c5052ca8fc-image.png

    fixed 🙂

  • 9 Votes
    47 Posts
    4k Views

    @phenomlab said in RSS parser script [NodeBB]:

    @jac Not yet. Sorry. Have some other work commitments I need to prioritise. Hoping to get to this over the weekend.

    No worries at all mate, thanks 👍🏻