Is it possible to use animate.style for hover animations?

I am interested in utilizing animate.style to display animation effects on hover rather than on page load. The new version of animate.css, known as animate.style, does not appear to have the hover functionality mentioned in its documentation.

I am unsure if this feature is supported or if there is an alternative approach to achieve it.

Any guidance in this area would be greatly appreciated as I aim to incorporate all animations upon hovering.

.d-flex  div {background:red;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.0.1/cerulean/bootstrap.min.css" rel="stylesheet"/>
  <div class="container-fluid my-5 bg-light">
    <div class="row">
        <div class="col-12 p-0">
            <div class="container py-5 text-center">
                <div class="row">
                    <div class="col-12"><h1>AMENITIES</h1></div>
                </div>
                <div class="row p-2">
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3 ">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__lightSpeedInRight" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>90 Berth Marina and Yacht Club</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__flip" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Excellent Hospitality Experiences</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__rotateIn" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Seaside and Marina Promenades</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__rotateIn" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Private Landscaped Terraces</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__rotateIn" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Private Facilities and Amenities</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__rotateIn" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Swimming Pools</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__rotateIn" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Beach Access</p></div></div>
                    <div class="col-lg-3 col-md-6 col-sm-12 p-3 h-100">
                        <div class="shadow-sm bg-white p-3"><img class="img-fluid animate__animated animate__rotateIn" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Cafes</p></div></div>

                </div>
          </div>
        </div>
    </div>
  </div>

<br><br>
<br>
<br>




<div class="d-flex flex-row bd-highlight mb-3">
  <div class="p-2 bd-highlight m-3">Flex item 1</div>
  <div class="p-2 bd-highlight m-3">Flex item 2</div>
  <div class="p-2 bd-highlight m-3">Flex item 3</div>
  <div class="p-2 bd-highlight m-3">Flex item 4</div>
  <div class="p-2 bd-highlight m-3">Flex item 5</div>
  <div class="p-2 bd-highlight m-3">Flex item 6</div>
  <div class="p-2 bd-highlight m-3">Flex item 7</div>
</div>

In the old version, I was able to achieve this using jQuery, but unfortunately, it does not work in the new version:

$(".wrapper").hover(function () {
        $(this).addClass("iconimage animated flipInY").delay(300);
        setTimeout(function () {
            $(this).addClass("iconimage animated flipInY");
        }, 200);
    }, function () {
        
        setTimeout(function () {
          
        }, 1000);
    });

    $(".SponsorLogoImg").mouseout(function () {
        
        setTimeout(function () {
         
        }, 100);
    });

Answer №1

If you're looking to add some animation effects to your website, JavaScript or jQuery can help with that.

Here's an example of how you can achieve this:

$(elem).mouseover(function(){
  $(this).addClass("animate__animated animate__flip");
  //You can customize by adding more classes
}); 
//To make the animation occur each time you hover over the element
$(elem).mouseout(function(){
  $(this).removeClass("animate__animated animate__flip");
});

Multiple animations in sequence:

$(elem).mouseover(function(){
    $(this).addClass("animate__animated animate__flip");
    //Customize with additional classes
    this.addEventListener('animationend',() => {
       $(this).removeClass("animate__animated animate__flip");
       //Adding a second animation
       $(this).addClass("animate__animated animate__bounce");
    });
});

Additional Resources:

For easy animation handling, check out animate.css-dynamic. It provides utility classes and more functionalities.

If you decide to use this library, here's an example of how you can integrate it:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/gh/KodingKhurram/animate.css-dynamic@main/animate.min.js"></script>

<h2 align="center"> Mouse over or click the image to animate</h2>
<img class="img-fluid ani_flip aniUtil_onMouse aniUtil_onClick aniUtil_active" style="max-width:80px" src="https://img.icons8.com/wired/2x/ccleaner.png" /><p>Excelllent Hospitality Experiences</p></div></div>

Check out the detailed documentation here.

Answer №2

Consider this scenario: when you take this action, the intended animation will play out.

To limit the scope of impact, consider opting for the ID over the target class.

.animate__animated:hover {
    animation-name: flip;
    animation-duration: 1s;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How is the Menu being populated?

I've been tasked with updating a website that was originally created by someone else. I am currently having trouble locating where I can make changes to the menu. The website in question is located at . The navigation.php file below is responsible for ...

Scrolling is disabled when using a full-screen background

My current issue involves a full screen background that is functioning properly when the window is resized, but it has caused a problem where scrolling is disabled when the page is longer than the window size. The content just gets cut off. Is there a way ...

Divs placed side by side are displaying a 1px gap in Safari, however, this issue is

On the website , there is a noticeable 1px gap between adjacent divs in Safari. However, this issue does not occur in other browsers such as Chrome and Firefox. The menu div is floated left and occupies 34% of the width, while the gallery div is floated r ...

Saving canvas generated images using the toDataURL() method in IE 11 triggers a "Security Error" message

I'm currently developing a browser-based tool for media distributors that involves manipulating video content. Within this tool, I have an HTML5 video player that loads videos from an external domain (e.g. ). The domain specifies the following header ...

What is the best way to stop the max-height transition from automatically scrolling to the top of the page?

Initially, I have a div with a max-height of 0 to hide it. When an anchor is clicked, the div's max height changes to 800px, revealing its content. However, every time this transition happens, the page automatically scrolls to the top instead of maint ...

What advantages does KnockoutJS offer over AngularJS?

Can KnockoutJS offer a unique feature that rivals or exceeds those of AngularJS? ...

Make an element in jQuery draggable but always within the viewport

My issue is that when I resize the window, the element stays in its position until I start dragging it. Once I drag it and then resize the window again, it doesn't stay within its container. To better illustrate my problem, you can view a demo on Fid ...

Is add1 missing from the DOM? Learn how to include it

Having an issue with Java-Script and an HTML form. The scenario is that there's a main form with an "Add" button, which when clicked should display a second form. Next to the second form is another button labeled "Add1," which ideally should trigger ...

Can the dimensions of an element be determined before adding it to the DOM using HTML, CSS, and JS?

My current task involves dynamically creating HTML elements using JavaScript. Here is an example: var newElement = document.createElement("div"); newElement.innerHTML = _data[i].content; newElement.className = "custom"; When the ...

How can I expand and collapse all the Bootstrap panels simultaneously?

Is it possible to make all three panels collapse and expand simultaneously with just one button? <button data-toggle="collapse" data-target="#collapseOne-1,#collapseTwo-1,#collapseThree-1" ...></button> <div id="#collapseOne-1" class="coll ...

Modifying search criteria using JavaScript

Yesterday, I posted a topic on Stack Overflow about how to change the search value in Wordpress using a drop-down selector. Initially, I implemented it with the help of Fredrik, but later I changed my approach. Instead of having a select input, I decided t ...

Whenever I nest my div tags within another div element in an HTML document

Whenever I try to position a div inside another div using float, I encounter problems. <div id="main"> <div id="anotherDiv"> <h1>Test</h1> </div> </div> Here is the corresponding style sheet: #main{ ba ...

Creating a pattern to insert a term inside HTML tags using regular expressions for beginners

I'm struggling to come up with a regular expression that can handle the following situation: I have numerous lines in this format: <a title="Match" href="http://mywebsite.com/category/Match"></a> What I need is for the word "Match" to b ...

Analyzing the current time against a user-inputted time using Javascript

Looking at this html and javascript code, the goal is to compare an input time with the current time. If the input time is less than 2 hours, "Less time" should be displayed in the label; if it's more than 2 hours, then "sufficient time" should appear ...

I seem to be experiencing difficulties with my dropdown menu as it is not

Having trouble creating a dropdown menu in HTML and CSS? If the subset of items in the parent items <ul> tags is not displaying properly on hover, you're not alone. The child items may be invisible or displayed incorrectly across the page. Chec ...

Tips for Displaying and Concealing Tables Using Radio Buttons

Does anyone know how to refactor the jQuery code to toggle between two selection options (Yes and No)? This is the jQuery code I have tried: $(document).ready(function() { $("#send_to_one").hide(); $("input:radio[name='decision']").chan ...

What is the best way to position a container div over another container using Bootstrap or CSS?

https://i.sstatic.net/q1qGi.png I'm working on a Bootstrap 4 layout where container B needs to overlay part of container A. I want to achieve a design where container B appears on top of container A. Any suggestions or references on how to achieve th ...

Guide to customizing CSS styles within a div element using TypeScript code in a Leaflet legend

I'm struggling to add a legend to my map using Angular 5 and typescript. I need help with setting CSS styles for the values (grades) that are displayed on the legend. Can someone guide me on where to put the styles? TS: createLegend() { let lege ...

Error Message Border Exceeds Width Limit and Spans Over Two Lines in Regular Expression

While working on creating a lengthy RegEx error message using server controls, I had the idea to add some style by giving the message a background color and border. However, when I tried to add a CSS class to the server control with a border and color, th ...

Is mastering canvas games a worthwhile pursuit?

Being passionate about creating a canvas game, I have some doubts about whether it's worth the effort. Here's why... With Adobe Flash, you can create highly complex animations, games, and apps. It makes me wonder if there will soon be a program ...