Unusual transparency effect in flip panel with varying CSS transition speed during hover?

I need help with flipping over div elements on hover. I have a few questions:

  1. How can I adjust the flip speed for when the user is no longer hovering? I was able to change the flip speed to 0.5s duration on hover, but how do I control the off-hover speed?

  2. Why does the background color of the front and back face act as transparent/glass where you can see both faces simultaneously? I only want to display the back face without any mirroring effect.

Any suggestions would be appreciated.

If you're unable to see the transparency issue, here's an image for reference.

https://i.sstatic.net/mvnDL.png

The intended result is a solid color panel displaying "ipsum" and "something." The mirror image of the front face should not be visible.

.flip_container {
    position: relative;
    margin: 10px auto;
    width: 270px;
    height: 200px;
    z-index: 1;
}
.flip_container {
    perspective: 1000;
}
.flip_card {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: all 1.0s linear;
}
.flip_container:hover .flip_card {
    transform: rotateY(180deg);
    transition-duration: 0.5s;
}
.face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    font-family: tahoma, sans-serif;
    text-align: center;
}
.face.front {
    font-weight: bold;
    font-size: 13pt;
    color: white;
}
.face.back {
    display: block;
    transform: rotateY(180deg);
    box-sizing: border-box;
    padding: 10px;
    color: white;
    text-align: center;
}
.imagebox {
    width: 260px;
    height: 160px;
    margin-top: 5px;
    margin-left: auto;
    margin-right: auto;
    padding-top: 5px;
}
.imagebox img {
    width: 250px;
    height: 150px;
    margin-left: auto;
    margin-right: auto;
}
.flip_card.purpleline {
    background-color: #BAADBA;
}
.flip_card.blueline {
    background-color: #ADB3BA;
}
.smaller {
    font-size: 11pt;
}
<div class="flip_container">
    <div class="flip_card purpleline">
        <div class="front face">
            <div class="imagebox">
                <img src="http://www.cats.org.uk/uploads/images/pages/photo_latest14.jpg" />
            </div>
            cat
        </div>
        <div class="back face">
            ipsum
            <br/><br/>
            <span class="smaller">
                sometext
            </span>
        </div>
    </div>
</div>
<div class="flip_container">
    <div class="flip_card blueline">
        <div class="front face">
            <div class="imagebox">
                <img src="http://animalia-life.com/data_images/dog/dog7.jpg" />
            </div>
            dog
        </div>
        <div class="back face">
            lorem
            <br/><br/>
            <span class="smaller">
                sometext
            </span>
        </div>
    </div>
</div>

Answer №1

Remember that CSS does not have specific selectors for :mousein or :mouseout events.

Instead, you can utilize the :hover selector to apply styles when hovering over an element. Make sure to define your default styles within a separate class, which will act as the base state without hover effects.

If needed, JavaScript can always be used to handle more complex interactions.

$('#element').hover(function(e){
    if(e.type==='mouseenter' || e.type==='mouseover'){
        // Your code for mousein event
    } else if(e.type==='mouseleave'){
        // Your code for mouseout event
    }
});

I hope this explanation clarifies any doubts you may have had.

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

A guide on implementing a jQuery click function on ng-click in an AngularJS application

Currently, I am developing a mobile app and utilizing MDL for the app's UI along with Angular JS. The theme I purchased from ThemeForest is called "FAB." My goal is to display data from the server using API's and showcase all the products that ar ...

Switching back and forth between two CSS animations using Jquery

I am working on creating a unique pendulum system using 3 balls. After successfully creating the balls and animating them, I am faced with a challenge in making the animation continuous. Here is my code: .circle { width:30px; height:30px; backgrou ...

I am looking to reposition the navbar span tag so that it appears beneath the icon, utilizing both HTML and CSS

I'm currently working on a navbar design with 5 items, each containing an icon and a span tag. However, I'm facing difficulties in aligning the span tag below the icon for all 5 items in the navbar. Despite my best efforts, I have been unable to ...

Automatically redirecting to a specific section upon clicking the textbox

I have developed a system where users can fill out forms and preview a PDF file. As they input information into the form, the PDF preview will update accordingly. Once all forms are filled out, users can generate a PDF of the completed document. I am look ...

"Cascading Style Sheets for Organizing Buttons in a Grid

I have created a layout in Word that I want to achieve: https://i.stack.imgur.com/krK7w.png After researching, I found out about the CSS grid layout which seems like the best option for achieving the desired layout. However, when implementing the grid i ...

The concept of Theme.breakpoints does not exist in MUI React, there is

I keep running into the same error where theme.breakpoints is undefined when I try to use theme.breakpoints.up in my code. The versions of the dependencies I am currently using are: "@emotion/react": "^11.9.0", "@emotion/styled&quo ...

Display loading spinner and lock the page while a request is being processed via AJAX

Currently, I am working on a project using MVC in C#, along with Bootstrap and FontAwesome. The main objective of my project is to display a spinner and disable the page while waiting for an ajax request. Up until now, I have been able to achieve this go ...

Add bullet points to the events listed in fullcalendar

Currently, I am implementing the 'fullcalendar' plugin from jquery in order to display events for a specific month. I am interested in adding bullets to the events, however, my online search did not yield any relevant results. Although I am awar ...

Insert fresh user information into the div

Learning JavaScript is a challenge I'm tackling. I have a question that may seem trivial, but any assistance would be greatly appreciated. I currently have this code: Javascript <script type="text/javascript"> function fn(){ var Name = ...

Unable to apply custom border color to Material UI Select component in React

I have been experimenting with material-ui v5 to improve my skills. I am currently struggling to customize the default style of the mui Select component. My goal is to modify the color of the Select element when it is being hovered over or in a focused sta ...

When a HTML file is piped or streamed into a browser, it is displayed as plaintext

I'm currently working with an Express handler router.get('/', ac.allow('Admin'), function (req, res, next) { let html = path.resolve(__dirname + '/../coverage/lcov-report/index.html'); fs.createReadStream(html).pip ...

Enhance Your Website with Dynamic Navigation Animation

Seeking assistance with animating a navigation bar on and off the screen from the left side. The nav is not animating as expected using the latest version of jquery.min.js. The first step was to animate the nav upon clicking an object. View the current pro ...

Develop and test a query by examining its structure, parsing it, and assessing its effectiveness

Building a query using different conditions selected from html controls in a textarea, allowing users to make modifications as needed. On the client side: a(1, 3) > 20 b(4, 5) < 90 c(3, 0) = 80 The query formed is: a(1, 3) > 20 and b(4, 5) < ...

Alter numerous classifications based on varying circumstances at regular intervals

This code snippet is designed to change randomly all the <div class="percentx"> elements, for example from <div class="percent31"> to <div class="percent52"> (with values between 1-100). It works smoothly. I ...

Pixel information from previous canvas remains intact post resizing

I have crafted a canvas and loaded pixel data at specific locations using the following code snippet. let maskCanvas = document.createElement("canvas"); let patchWidth = 30; let patchHeight = 30; let scale = 3; maskCanvas.setAttribute("class", "mask"); ...

What is the method for formatting within the <textarea> element?

While working on developing a comment system, I recently made the discovery that text areas cannot be formatted to retain paragraphs, line breaks, etc. This was particularly noticeable when comparing sites like StackOverflow, which uses a text editor inste ...

Increase the vertical distance between rows in a table

Having some issues with customizing a data grid that I developed. Is there a way to eliminate the header bottom border and insert spacing between each row in the table? View Demo Example Code: <dx-data-grid style="margin-top:50px" class="table" [dat ...

Is there a way to navigate to a specific <li> element using scrolling?

Is there a way to direct a user to a URL and have it automatically scroll to a specific <li> element? For example, navigating to mysite.com/something.html#someItem should take the user directly to: Something here ...

Prevent HTML from being escaped in data-binding while utilizing repeat-templates in Polymer

Hey there! <template repeat="{{item in items}}"> <div layout horizontal> <div>{{item['content']}}</div> <div>{{item['more_content'])}</div> ...

Experiencing issues with the Google Drive file selection API due to JavaScript

I am having trouble implementing a Google file picker in my Django Project. Every time I try to create an HTML page with an integrated Google file picker, I encounter a 500 "Something went wrong" error. https://i.sstatic.net/6JMh7.png This issue arises a ...