A CSS transition with a delay set to ease-out without an ease-in effect

I currently have a basic menu setup with a dropdown feature. The dropdown displays correctly with the following CSS property:

-webkit-transition: all 0.4s ease-in-out;

However, I am attempting to modify it to only transition based on height while maintaining the 0.4s ease-in effect. Additionally, I would like to introduce a 1s delay for the ease-out transition.

I have experimented with the following code:

-webkit-transition: height 0.4s ease-in, height 0.4 ease-out 1s;

Unfortunately, this implementation also applies the delay during the ease-in transition.

The desired outcome is for the ease-out transition to trigger when hovering over an element but without any delay while easing out.

Am I facing limitations or making a mistake in my approach?

Answer №1

When you initiate an animation with 'ease-in', it will work at the beginning of the animation. Conversely, using 'ease-out' will make it function towards the end. You have the flexibility to add a different animation when hovering and personalize it according to your preferences.

Answer №2

I finally stumbled upon an example that appears to be effective, and I have created a small prototype here: https://codepen.io/andrelange91/pen/zYRyRyw

In this demonstration, I separated the two elements, resulting in a hover on and hover off effect.

.box {
  height:100px;
  // hover off
  transition: height 0.4s ease-out 1s;
  &:hover{
    // hover on
    transition: height 0.4s ease-in;
    height:150px;
  }
}

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

Do mouse users prefer larger buttons on RWD sites for a better experience?

Not entirely certain if this platform is the most suitable for posing this query, so if warranted, please close it and recommend a more appropriate venue for such inquiries. In the realm of responsive web design (RWD) today, it is common practice for webs ...

alternative for firebug in internet explorer

I'm currently on the lookout for a Firebug alternative that works well with Internet Explorer 8. I gave Firebug Lite a shot by simply embedding the JavaScript code in my HTML files, however, it wasn't as effective as I hoped. My website, way2enj ...

Sleek CSS3 Slide Menu - Smooth Transition to Top when Sliding

I have been experimenting with a CSS-only slide menu. Essentially, I set the nav menu position to fixed with top: 0 and right:-200 using radio buttons for control. <input type="radio" id="nav-expand" name="nav" /> <input type="radio" id="nav-col ...

What is the best way to create an oval-shaped background for a div element?

Can someone help me achieve an oval shape for my index page div? I tried using border-radius but the edges are too round for my liking. I am looking for a more specific result See the CSS code below for reference <div class="home-page"></div> ...

Problem of background and shadow blending in CSS

I'm experimenting with creating an element using a radial gradient effect. My initial approach was to use a white circular container and apply a white box shadow. However, I encountered some issues where the color of the shadow did not match the backg ...

CSS tutorial: Creating circular image borders and outlines with CSS

I recently designed a graphic showcasing a sales consultation process using 4 images displayed side by side. To give the images a unique style, I used CSS to turn them into circular images and added a background image to create visual cohesion between them ...

Questions about CSS

I am currently in the process of creating a new website and I am encountering some challenges. Here is a preview of the HTML/CSS: Specifically, I have some questions regarding the CSS: 1) Why does the hover effect only work on "OM OS" and "KONSULENT," bu ...

Utilizing the map function in React to create a button reference

I am currently facing an issue that is relatively simplistic and doesn't have any real-world application. My goal is to locate a 'green' button and make it blink for a duration of 3 seconds. How can I achieve this using React? const btnLay ...

Adjustable width (100%) and set height for SVG

I am attempting to insert an SVG object onto my HTML page with a width of 100% and a fixed height. Upon viewing my fiddle, you will notice that the height of the dark-grey object changes based on the window proportions, which is not the desired outcome. ...

What should we name this particular style of navigation tab menu?

What is the name of this tab menu that includes options for next and previous buttons? Additionally, is there a material-ui component available for it? https://i.sstatic.net/0m9rH.png ...

How can you easily ensure your React web app is responsive?

As I delve into building a web app using reactjs, one particular challenge I encounter is ensuring its responsiveness. An issue arises when the browser size changes, causing my components to overlap and lose alignment. Is there an easy solution to preven ...

Correct punctuation will not be displayed accurately

I'm really struggling with this issue. My website has multiple pages, and on about half of them the punctuation is not showing up correctly. For instance, on the punctuation is displaying as "Highlights: ✓ Cyclo Hanoi Tour ✓ Overnight ...

What causes the disruption of vertical alignment among inline-block elements when using overflow:hidden?

Take a look at these two JSFiddles: http://jsfiddle.net/am28dsbz http://jsfiddle.net/am28dsbz/1/ Why is it that the first one shows my text aligned correctly, while the second one displays the first link lower than the second? Stack Overflow requires m ...

Creating structured layout with Bootstrap 4 Grid System

Can anyone provide guidance on achieving a grid style similar to this in bootstrap 4? I appreciate any assistance. https://i.sstatic.net/yCSFt.jpg ...

Ways to animate elements while scrolling in React.js?

I am new to using React.JS and currently working on setting up an E-commerce Store. My goal is to have 5 images stack on top of each other and move together as the user scrolls. I used to achieve this effect in Vanilla JavaScript by adding a window.addEven ...

What is the best way to insert a vertical line divider between two tabs?

Looking to add a vertical line (|) between the tabs. <p-tabView> <p-tabPanel header="Header I"> <p> Lorem ipsum dolor sit amet... </p> </p-tabPanel> <p-tabPanel header=" ...

Element floating over, intersecting with the main content of the page

I am facing an issue with my CSS-styled footer that floats at the bottom of the page. When I resize the browser window, the footer overlaps the contents of the page. Although the footer is quite large, it should not overlay the page content. body { pa ...

Finding and removing a specific CSS pattern from a webpage that has been loaded

Encountered a troublesome Amazon.com page that appears blank in print preview, specifically the Online Return Center\Your Return Summary page. After much troubleshooting on a locally saved copy of the webpage, I pinpointed the issue to a problematic l ...

Guide on showcasing an icon adjacent to the input fields once they have been validated successfully with the help of jquery plugins

I am struggling with the code below which is supposed to validate the SubmitForm when the button is clicked. It successfully changes the textboxes to red and displays an error message with a symbol if validation fails. However, I am wondering how I can sho ...

Use jQuery to dynamically alter color based on conditional statements

What could be causing the background color not to change to green? var id; id = setInterval(changeColor, 1000); function changeColor(){ var elem= $("#target"); var color = elem.css('background-color'); if (color == &apos ...