Skip to content

Make logo rotate on page load and hover

Solved Customisation
20 2 4.5k 1
  • @phenomlab

    exactly

    effect to happen on page load and on hover.
    Same effect

    @DownPW For page load you will likely need a trigger created by jQuery. Whilst it’s feasible to execute animation via transform in CSS on page load, the CSS is probably being loaded after the page, meaning it won’t fire.

    You could test this on a standard page with the CSS inline to see if that works first before you explore the other route.

  • @DownPW For page load you will likely need a trigger created by jQuery. Whilst it’s feasible to execute animation via transform in CSS on page load, the CSS is probably being loaded after the page, meaning it won’t fire.

    You could test this on a standard page with the CSS inline to see if that works first before you explore the other route.

    @phenomlab

    odd you hav this 2 effect here…

  • @phenomlab

    odd you hav this 2 effect here…

    @DownPW I don’t. If I press F5 to reload the tags page, there is no animation?

  • @DownPW I don’t. If I press F5 to reload the tags page, there is no animation?

    @phenomlab @DownPW wait - I see what you mean now - you’re talking about the rotating logo 🙂 - the title of this post threw me, so I’ll split this to a new topic to avoid confusion

  • @phenomlab

    odd you hav this 2 effect here…

    @DownPW Add this to your CSS

    .header .forum-logo {
        display: inline-block;
        animation-name: rotate180, rotate0;
        animation-duration: 1000ms;
        animation-delay: 0s, 1000ms;
        animation-iteration-count: 1;
        animation-timing-function: linear;
        transition: transform 1000ms ease-in-out;
    }
    
  • @DownPW Add this to your CSS

    .header .forum-logo {
        display: inline-block;
        animation-name: rotate180, rotate0;
        animation-duration: 1000ms;
        animation-delay: 0s, 1000ms;
        animation-iteration-count: 1;
        animation-timing-function: linear;
        transition: transform 1000ms ease-in-out;
    }
    

    @phenomlab

    I already tried.this 😉

    If I add this code, work at loading page works but the mouse over doesn’t work anymore 😉

  • @phenomlab

    I already tried.this 😉

    If I add this code, work at loading page works but the mouse over doesn’t work anymore 😉

    @DownPW Can you put it back so I can test?

  • @DownPW Can you put it back so I can test?

    @phenomlab done

  • @DownPW I see the issue. Try

    .header a.forum-logo:hover {
        display: inline-block;
        animation-name: rotate180, rotate0;
        animation-duration: 1000ms;
        animation-delay: 0s, 1000ms;
        animation-iteration-count: 1;
        animation-timing-function: linear;
        transition: transform 1000ms ease-in-out;
    }
    
  • @DownPW I see the issue. Try

    .header a.forum-logo:hover {
        display: inline-block;
        animation-name: rotate180, rotate0;
        animation-duration: 1000ms;
        animation-delay: 0s, 1000ms;
        animation-iteration-count: 1;
        animation-timing-function: linear;
        transition: transform 1000ms ease-in-out;
    }
    

    @phenomlab said in Make logo rotate on page load and hover:

    .header a.forum-logo:hover {
    display: inline-block;
    animation-name: rotate180, rotate0;
    animation-duration: 1000ms;
    animation-delay: 0s, 1000ms;
    animation-iteration-count: 1;
    animation-timing-function: linear;
    transition: transform 1000ms ease-in-out;
    }

    not working 😉

  • @phenomlab said in Make logo rotate on page load and hover:

    .header a.forum-logo:hover {
    display: inline-block;
    animation-name: rotate180, rotate0;
    animation-duration: 1000ms;
    animation-delay: 0s, 1000ms;
    animation-iteration-count: 1;
    animation-timing-function: linear;
    transition: transform 1000ms ease-in-out;
    }

    not working 😉

    @DownPW Can you give me admin access to your site please (PM me)

  • @phenomlab said in Make logo rotate on page load and hover:

    .header a.forum-logo:hover {
    display: inline-block;
    animation-name: rotate180, rotate0;
    animation-duration: 1000ms;
    animation-delay: 0s, 1000ms;
    animation-iteration-count: 1;
    animation-timing-function: linear;
    transition: transform 1000ms ease-in-out;
    }

    not working 😉

    @DownPW Should work now, yes? 🙂

    The issue is that you are declaring the same keyframe state twice

    All you should use is the below

    .header .forum-logo {
        float: left;
        max-height: 50px;
        height: 50px;
        width: auto;
        max-width: 150px;
        display: inline-block;
        margin-left: 0px;
        display: inline-block;
        animation-name: rotate180, rotate0;
        animation-duration: 1000ms;
        animation-delay: 0s, 1000ms;
        animation-iteration-count: 1;
        animation-timing-function: linear;
        transition: transform 1000ms ease-in-out;
    }
    
    .forum-logo:hover {
        transform: rotate(180deg);
    }
    

    Basically, you only need the transform on hover

  • @DownPW Should work now, yes? 🙂

    The issue is that you are declaring the same keyframe state twice

    All you should use is the below

    .header .forum-logo {
        float: left;
        max-height: 50px;
        height: 50px;
        width: auto;
        max-width: 150px;
        display: inline-block;
        margin-left: 0px;
        display: inline-block;
        animation-name: rotate180, rotate0;
        animation-duration: 1000ms;
        animation-delay: 0s, 1000ms;
        animation-iteration-count: 1;
        animation-timing-function: linear;
        transition: transform 1000ms ease-in-out;
    }
    
    .forum-logo:hover {
        transform: rotate(180deg);
    }
    

    Basically, you only need the transform on hover

    @phenomlab

    grrrrrrr
    grrrrr

    that simple…

    Thanks Mark

  • DownPWundefined DownPW has marked this topic as solved on

Did this solution help you?
Did you find the suggested solution useful? Support 💗 Sudonix with a coffee
If your organisation needs deeper expertise around infrastructure, security, or technology leadership, learn more about Phenomlab Ltd. Many of the deeper technical guides behind Sudonix are published there.

Related Topics
  • Custom Page - nodebb

    Solved Customisation custom-pages nodebb
    13
    2
    5 Votes
    13 Posts
    2k Views
    I’m happy to see this
  • 14 Votes
    17 Posts
    4k Views
    No problem dude ! I hope you have a good vacation. Enjoy your loved ones!
  • Page control arrows for PWA

    Solved Customisation nodebb
    27
    25 Votes
    27 Posts
    12k Views
    @crazycells it is, yes - I think I’ll leave it as there is no specific PWA CSS classes I know of. Well, you could use something like the below, but this means multiple CSS files for different operating systems. /** * Determine the mobile operating system. * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'. * * @returns {String} */ function getMobileOperatingSystem() { var userAgent = navigator.userAgent || navigator.vendor || window.opera; // Windows Phone must come first because its UA also contains "Android" if (/windows phone/i.test(userAgent)) { return "Windows Phone"; } if (/android/i.test(userAgent)) { return "Android"; } if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { return "iOS"; } return "unknown"; // return “Android” - one should either handle the unknown or fallback to a specific platform, let’s say Android } Once you’re in that rabbit hole, it’s impossible to get out of it.
  • nodebb-plugin-custom-pages

    Solved Customisation plugin custom-pages
    5
    2
    3 Votes
    5 Posts
    4k Views
    @DownPW it’s possible, yes, but you may inadvertently end up targeting other elements using the same class which of course isn’t desired. Can you provide a link in DM for me to review?
  • The best css to customize our logo?

    Solved Customisation css
    2
    1 Votes
    2 Posts
    2k Views
    @Sala This should look better .sidenav .navbar-brand { padding-top: 0.5rem; padding-bottom: 0.5rem; } [image: 1669026666905-e5cec20e-be36-4ee8-9129-fd11ad4656ac-image.png] You can increase the top and bottom padding by increasing the values above.
  • hover link effect

    Solved Customisation css link hover
    18
    1
    6 Votes
    18 Posts
    5k 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.
  • fading in /tags page

    Solved Customisation nodebb
    32
    1
    30 Votes
    32 Posts
    11k Views
    Fix working perfectly
  • 2 Votes
    10 Posts
    3k Views
    @DownPW We just have to change the cycles automatically according to each period ? Yes, this is by far the safest I think it is possible to achieve the goal, I have already seen this kind of thing on a site without any perf problems. It’s certainly possible, but not without issues or impact to performance (in my view)