Skip to content

Make logo rotate on page load and hover

Solved Customisation
  • @DownPW said in fading in /tags page:

    .header .forum-logo, img.forum-logo.head {
    max-height: 50px;
    width: auto;
    height: 30px;
    margin-top: 9px;
    max-width: 150px;
    min-width: 32px;
    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;
    }

    like this ? Because I have the effect but just at the refresh page and not on Mouse over

    .header .forum-logo, img.forum-logo.head:hover {
        max-height: 50px;
        width: auto;
        height: 30px;
        margin-top: 9px;
        max-width: 150px;
        min-width: 32px;
        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;
        
        @keyframes rotate180 {
            from {
              transform: rotate(0deg);
            }
           
            to {
              transform: rotate(180deg);
            }
          }
           
          @keyframes rotate0 {
            from {
              transform: rotate(180deg);
            }
           
            to {
              transform: rotate(0deg);
            }
          }
          
    }
    

    EDIT:

    I have it !!!

    @keyframes rotate180 {
            from {
              transform: rotate(0deg);
            }
           
            to {
              transform: rotate(180deg);
            }
          }
           
          @keyframes rotate0 {
            from {
              transform: rotate(180deg);
            }
           
            to {
              transform: rotate(0deg);
            }
          }
          
    .header .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 said in fading in /tags page:

    Because I have the effect but just at the refresh page and not on Mouse over

    How to have this effect when reloading the page and the mouse over at the same time.

    So far I can only get one or the other…

    For resume my css code :

    @keyframes rotate180 {
            from {
              transform: rotate(0deg);
            }
           
            to {
              transform: rotate(180deg);
            }
          }
           
          @keyframes rotate0 {
            from {
              transform: rotate(180deg);
            }
           
            to {
              transform: rotate(0deg);
            }
          }
          
    .header .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 😉

    @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 said in fading in /tags page:

    Because I have the effect but just at the refresh page and not on Mouse over

    How to have this effect when reloading the page and the mouse over at the same time.

    So far I can only get one or the other…

    For resume my css code :

    @keyframes rotate180 {
            from {
              transform: rotate(0deg);
            }
           
            to {
              transform: rotate(180deg);
            }
          }
           
          @keyframes rotate0 {
            from {
              transform: rotate(180deg);
            }
           
            to {
              transform: rotate(0deg);
            }
          }
          
    .header .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 Why would you reload and mouse over at the same time ?

  • @DownPW Why would you reload and mouse over at the same time ?

    @phenomlab said in fading in /tags page:

    Why would you reload and mouse over at the same time ?

    When I say at the same time it is that I expressed myself badly.

    Just have both effects and not one or the other

  • @phenomlab said in fading in /tags page:

    Why would you reload and mouse over at the same time ?

    When I say at the same time it is that I expressed myself badly.

    Just have both effects and not one or the other

    @DownPW Is in DEV or PROD ?

  • @DownPW Is in DEV or PROD ?

    @phenomlab

    Prod actually

  • @phenomlab

    Prod actually

    @DownPW Ok, but can you explain the desired result - do you want the hover effect to happen on page load for example as well as on hover?

  • @DownPW Ok, but can you explain the desired result - do you want the hover effect to happen on page load for example as well as on hover?

    @phenomlab

    exactly

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

  • @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? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

Related Topics
  • 14 Votes
    17 Posts
    425 Views
    No problem dude ! I hope you have a good vacation. Enjoy your loved ones!
  • Page control arrows for PWA

    Solved Customisation
    27
    25 Votes
    27 Posts
    2k 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 icon on google page

    Solved Customisation
    9
    1
    4 Votes
    9 Posts
    778 Views
    @Panda It’s been raised multiple times, but only for the open source version, and not hosted.
  • nodebb-plugin-custom-pages

    Solved Customisation
    5
    2
    3 Votes
    5 Posts
    652 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
    2
    1 Votes
    2 Posts
    552 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.
  • fading in /tags page

    Solved Customisation
    32
    1
    30 Votes
    32 Posts
    3k Views
    Fix working perfectly
  • 2 Votes
    10 Posts
    1k 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)
  • 5 Votes
    9 Posts
    2k Views
    @phenomlab Very very great Mark Thanks again, It’s perfect now ! –> I share my code that I modified. I’ve added French and English comments. If you see things to change Mark, don’t hesitate. As usual, all the access paths (FA icons, logo) will have to be modified according to your architecture. You can also very well add/remove time slots and change welcome messages to suit your needs. Widgets ACP/HTML Widget Footer Logo <center> <br><br> <img id="thislogo" src="path/to/my/image"> </center> Widget Welcome Message <!-- IF loggedIn --> <div class="getUsername">, <a href="/me"><span class="username"></span></a></div> <!-- ENDIF loggedIn --> CSS – I added the size font-weight: 900; in the CSS because otherwise some FA icon wasn’t displayed correctly and reduce margin : i#thisicon { font-family: "Font Awesome 5 Free"; font-style: normal; margin-right: 8px; font-weight: 900; } .getUsername { padding-top: 20px; text-align: right; } /*Smartphone*/ /*On désactive le message de bienvenue"*/ /*We disable the welcome message"*/ @media all and (max-width: 1024px) { .getUsername { display: none; } } JAVASCRIPT // ------------------------------------------ // Welcome Message avec icône et Footer logo // Welcome Message with icon and Footer logo // ------------------------------------------ $(window).on('action:ajaxify.end', function (data) { //On récupère le username dans le DOM et on l'affiche //We retrieve the username from the DOM and display it function updateUsername() { $('.getUsername .username').text(app.user.username); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', updateUsername); } else { updateUsername(); } //On déclare les variables principales (themessage & thehours) ainsi que les variables secondaires correspondants aux plages horaires //We declare the main variables (themessage & thehours) as well as the secondary variables corresponding to the time slots var thehours = new Date().getHours(); var themessage; var wakeup = ('Good day'); var morning = ('Good morning'); var lunch = ('Bon appétit'); var afternoon = ('Good afternoon'); var drink = ('Cheers'); var evening = ('Good evening'); var night = ('Good night'); var welcome = ('Welcome'); var matched = false; //On peux ici tester le résultat du code en spécifiant une heure (!!!IMPORTANT: Commenter une fois le script testé!!!) //Here we can test the result of the code by specifying a time (!!!IMPORTANT: Comment once the script has been tested!!!) //thehours = 20 //On déclare les plages horaires avec les icones FA et les logos //We declare the time slots with FA icons and logos path if (thehours >= 0 && thehours < 6) { themessage = night; theicon = "fa-solid fa-moon"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 6 && thehours < 8) { themessage = wakeup; theicon = "fa-solid fa-mug-hot"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 8 && thehours < 12) { themessage = morning; theicon = "fa-solid fa-sun"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 12 && thehours < 13) { themessage = lunch; theicon = "fas fa-hamburger"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 13 && thehours < 16) { themessage = afternoon; theicon = "fa-solid fa-sun"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 16 && thehours < 18) { themessage = welcome; theicon = "fa-solid fa-rocket"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 18 && thehours < 19) { themessage = drink; theicon = "fa-solid fa-wine-glass"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 19 && thehours < 20) { themessage = lunch; theicon = "fas fa-pizza-slice"; thelogo = "/assets/customlogo/XXX.png"; } else if (thehours >= 20 && thehours < 24) { themessage = evening; theicon = "fa-solid fa-tv"; thelogo = "/assets/customlogo/XXX.png"; } // Si la page active est un topic, on désactive/cache le message de bienvenue // If the active page is a topic, we deactivate/hide the welcome message if (window.location.href.indexOf("topic") > -1) { console.log("This is a topic, so hide the user welcome message"); $('#thisuser').hide(); } // Sinon, on affiche le message en fonction, l'icone FA et son emplacement (prepend) // Otherwise, we display the message in function, the FA icon and its location (prepend) else { $('.getUsername').prepend("<i id='thisicon' class='" + theicon + "'></i>" + themessage); $("#thislogo").attr("src", thelogo); //$('.getUsername').prepend("<img id='thisicon' src='" + thelogo + "'></>" + themessage); } });