Skip to content

Change border colour of original poster to match category

Solved Customisation
  • One simple feature I wanted in Sudonix was for the border of the first post in a new thread to match the colour set by the category. This makes the first post stand out, and looks nice too 🙂

    The code is based around the same functionality here

    https://sudonix.com/topic/256/recent-cards-plugin-customization

    It’s relatively simple in it’s approach. Here is is

    $(document).ready(function() {
        $(window).on('action:ajaxify.end', function(data) {
       var categoryColor = $('[role="presentation"].icon').css("background-color");
                    $('li.topic-owner-post:nth-child(1)').css('border-color', categoryColor);
        });
    });
    

    Essentially, this jQuery snippet looks for the role="presentation" attribute in the topic stream (there’s only the one, so no need for any loop to detect all of them like we do in the previous link), grab the CSS value, and then set it as the border so it looks like this

    53ed0377-97d3-4d3b-b445-cb0f46bdd52f-image.png

    All you need to do is copy the snippet, and place this in your ACP -> Appearance -> Custom JS

    Enjoy…

  • phenomlabundefined phenomlab has marked this topic as solved on
  • phenomlabundefined phenomlab referenced this topic on

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 💗

Related Topics