Skip to content

Changing the look of recent cards

Announcements
  • I wanted a way to draw attention to the recent cards on the categories page to make them stand out more - and what better way to do this than with some CSS. Here’s a short video of the outcome of that very exercise. Watch the recent cards closely as I cycle through the themes.

    There’s a gradient being set there which is essentially two of the core colours in each theme.

    For example, in swatch “Anthracite”, it’s easy to see how this effect works

    1981b09d-671d-42c7-89ae-555f30916669-image.png

    Essentially, we are setting the border-color and color variables to match the color set by the category itself. Essentially, this is an extension of this thread
    https://sudonix.com/topic/256/recent-cards-plugin-customization

    The minor change here is just one line

    $(document).ready(function() {
        $(window).on('action:ajaxify.end', function(data) {
            $('.recent-card-container').each(function(i) {
                var dataId = $(this).attr("data-cid");
                var color = $('[role="presentation"]', this).css("background-color");
                //console.log("data-cid " + dataId + " is " + color);
                $('[data-cid="' + dataId + '"] .recent-card').attr("style", "border-color: " + color);
                $('[data-cid="' + dataId + '"] .recent-card h4 a').attr("style", "color: " + color);
            });
        });
    });
    

    The line in question is

    $('[data-cid="' + dataId + '"] .recent-card h4 a').attr("style", "color: " + color);
    

    By adding this line, we change both the border color, and the text color to match. I also chose to thicken the border by 1px to give it a bit more depth, which works very well. I did consider a box-shadow but I think that may look somewhat “overdone” and odd when coupled with other elements. The jury is still out on that one 🙂


Related Topics
  • Ch..ch..ch..ch..changes!

    Announcements
    16
    15 Votes
    16 Posts
    170 Views

    @phenomlab of course, to be recognised is fantastic.

    @phenomlab said in Ch..ch..ch..ch..changes!:

    Sadly, no. Web crawlers and scrapers are often JS based and read text only, so styles don’t have any bearing.

    I’ve read mixed things about this, but no that does make sense, it was something I read a many years back when using Wordpress.

  • ANNOUNCEMENT: Social Login Changes

    Announcements
    4
    6 Votes
    4 Posts
    455 Views

    @DownPW Always looking for ways to improve the overall experience.

  • Material View Support for Stock NodeBB

    Unsolved Let's Build It
    51
    15 Votes
    51 Posts
    3k Views

    Oh yes, that’s what’s super cool, I learn something every day. Afterwards I start from so low in JS

  • IMPORTANT: Theme / Swatch changes

    Announcements
    4
    6 Votes
    4 Posts
    276 Views

    @cagatay these changes aren’t published anywhere presently, so nothing for you to do.

  • hover link effect

    Solved Customisation
    18
    6 Votes
    18 Posts
    1k Views

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

  • chat list navbar

    Solved Customisation
    30
    3 Votes
    30 Posts
    2k Views

    No no it’s ok @phenomlab
    I just comment the 2 lines mentionned aboves 😉

  • New message CSS problem

    Unsolved Customisation
    11
    2 Votes
    11 Posts
    698 Views

    @DownPW hi. Sorry for digging up an old post, but I’m going through items still unresolved and was looking to get an understanding of where you are currently with this?

  • [NODEBB] Reply Button/arrow answer

    Solved Customisation
    25
    4 Votes
    25 Posts
    2k Views

    Topic open
    https://sudonix.com/topic/207/nodebb-help-for-my-custom-css