Accidental delay upon mouse exit

Upon hovering over, the transition immediately begins, but there is a delay of about 300ms before the reverse transition starts upon hovering off. (https://example.com)

<div id="isa-hover-gallery">

<a href="https://example-link.com">
<div class="isa-image" style="background-image:url('https://example-image.jpg')">
<div class="slide-text">
<p><b>Text Here</b></p>
<p>Additional text goes here...</p>
</div>
</div>
</a>

</div>

#isa-hover-gallery {
  display: flex;
  flex-wrap: wrap;
}
#isa-hover-gallery .isa-image {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 215px;
  min-width: 320px;
  margin: 0 24px 24px 0;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  cursor: pointer;
}
#isa-hover-gallery .isa-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0,0,0,0);
  transition: 300ms ease-in;
}
#isa-hover-gallery .isa-image > span {
  position: relative;
  z-index: 11;
  opacity: 0;
  color: #ffffff;
  font-size: 20px;
  font-family: 'Open Sans', sans-serif;
  transition: 300ms ease-in;
}
#isa-hover-gallery .isa-image .slide-text {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 4px 6px;
  background-color: rgba(0,0,0,0.8);
  color: #ffffff;
  z-index: 11;
}
#isa-hover-gallery .isa-image .slide-text p:first-child {
  padding-bottom: 0;
}
#isa-hover-gallery .isa-image .slide-text p:last-child {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  transition: 600ms ease-in;
}
#isa-hover-gallery .isa-image:hover::after {
 background-color: rgba(0,0,0,0.6);
}
#isa-hover-gallery .isa-image:hover > span {
  opacity: 1;
}
#isa-hover-gallery .isa-image:hover .slide-text p:last-child {
  max-height: 1000px;
  margin: auto;
  padding: auto;
}

Various attempts with different transition speeds and disabling transitions on other elements have been unsuccessful in resolving the issue.

Answer №1

The reason for this issue is due to the excessive value set for the max-height property in the animation. To resolve this, simply reduce the value of max-height:

#isa-hover-gallery {
  display: flex;
  flex-wrap: wrap;
}

#isa-hover-gallery .isa-image {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 215px;
  min-width: 320px;
  margin: 0 24px 24px 0;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  cursor: pointer;
}

#isa-hover-gallery .isa-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0);
  transition: 300ms ease-in;
}

#isa-hover-gallery .isa-image>span {
  position: relative;
  z-index: 11;
  opacity: 0;
  color: #ffffff;
  font-size: 20px;
  font-family: 'Open Sans', sans-serif;
  transition: 300ms ease-in;
}

#isa-hover-gallery .isa-image .slide-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right:0;
  padding: 4px 6px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  z-index: 11;
}

#isa-hover-gallery .isa-image .slide-text p:first-child {
  padding-bottom: 0;
}

#isa-hover-gallery .isa-image .slide-text p:last-child {
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  transition: 600ms ease-in;
}

#isa-hover-gallery .isa-image:hover::after {
  background-color: rgba(0, 0, 0, 0.6);
}

#isa-hover-gallery .isa-image:hover>span {
  opacity: 1;
}

#isa-hover-gallery .isa-image:hover .slide-text p:last-child {
  max-height: 100px;
  margin: auto;
  padding: auto;
}
<div id="isa-hover-gallery">

  <a href="https://febc.org/indonesia">
    <div class="isa-image" style="background-image:url('https://febc2017.wpengine.com/wp-content/plugins/justified-image-grid/timthumb.php?src=https%3A%2F%2Ffebc2017.wpengine.com%2Fwp-content%2Fuploads%2FEmail-1-Pakistan-Listener-Story_banner-image-900x600.jpg&h=560&w=798&q=45&f=.jpg')">
      <div class="slide-text">
        <p><b>Sharing His Faith in Pakistan</b></p>
        <p>Anam* was given an extraordinary opportunity after he came to faith in Christ…He was asked to preach from the Bible in the mosque his father ran…</p>
      </div>
    </div>
  </a>

</div>

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

Can someone help me troubleshoot why my multi-step form is not functioning properly?

I've been working on a multi-phase form, but it's not behaving as expected. I've tried different code variations, but for some reason, it's not functioning properly. After spending two days on it, I'm starting to feel a bit frustra ...

Limiting the height of a grid item in MaterialUI to be no taller than another grid item

How can I create a grid with 4 items where the fourth item is taller than the others, determining the overall height of the grid? Is it possible to limit the height of the fourth item (h4) to match the height of the first item (h1) so that h4 = Grid height ...

Changing from a vertical to horizontal menu as the parent div is resized

I am looking for a solution to create a CSS effect or Javascript code that will hide a menu inside a div when the browser window or parent div is resized. I want to display another div with the same menu in horizontal orientation when the first one is hidd ...

Basic color scheme

I'm attempting to change the background color behind a partially transparent .png div. The CSS class that modifies the div is ".alert". Manually editing the .alert class background color works perfectly, and now I want to automate this on a 1-second c ...

Issues with html5 dropdown menu not displaying properly when hovered over

As a beginner in programming, I have been tasked with creating a website using HTML5 and CSS. The main issue I am encountering is with my horizontal menu bar that has vertical sub-menus appearing on hover. The menu consists of 3 main tabs: Home, Health, a ...

Effortlessly transition a div with seamless animation as it moves across the screen

I need help with an absolutely positioned div: class MyDiv extends React.Component { state = { stepCount: 0 }; componentDidMount(){ setInterval(() => { this.setState({ stepCount: this.state.stepCount + 1 }) }, 1000); } ren ...

The Chrome browser is failing to detect the hover function of the Surface Pen stylus

Encountering an issue with the hover pseudo-class not functioning properly on Surface pad's Chrome browser. The hover effect is working as expected in other browsers, but not in Chrome. I am using a Surface pen to test the hover functionality. HTML: ...

Creating a sleek Bootstrap layout with two columns housing containers within

Struggling with the layout in Bootstrap, I can't seem to figure out how to properly nest a "container" class within a full-width "row" class for perfect content alignment. Check out the image below for reference and a snippet of my code. https://i.s ...

Ruby Thin Server: An Unexpected ActionView Template Error

Encountering an issue when trying to deploy my project on Amazon Web Services and accessing the domain. ActionView::Template::Error (Command 'java -jar /home/ubuntu/.rvm/gems/ruby-2.1.10@silk/gems/yui-compressor-0.12.0/lib/yui/../yuicompressor-2.4.8 ...

Getting rid of the outline on <html> while tabbing in Firefox

An odd outline keeps appearing as I tab through elements on a website, but only in Firefox and not in Chrome, Safari, or Opera. To identify the element causing the focus, I used Firebug console by typing: document.activeElement. It showed: >>> d ...

The appearance of the circle in Safari is rough and lacks smoothness

My circle animation works perfectly on Google Chrome, but when I switch to Safari the edges appear faded and blurry. I tried adding "webkit" to fix it, but had no luck. Is there a compatibility issue with Safari and CSS animations? Here is my code: Snapsh ...

What is the best way to customize the appearance of the initial row in each tr cluster?

Looking to add a button for expanding child rows within a datatable, with each group in the table having the same child elements.... The provided CSS currently displays the icon on every row throughout the entire table. td.details-control { backg ...

Use PHP to highlight the row that has been selected in an HTML table

I am currently working on a project where I have styled multiple HTML tables on my website using alternating gray and white bands. Now, my goal is to highlight the selected row in a darker shade of gray. I have experimented with various solutions, and the ...

How about a CSS grid featuring squares with square images?

Just like the inquiry found on this page, I am striving to construct a grid of perfect squares, each containing an image with 100% height. The issue arises from utilizing the padding-bottom: 100%; height: 0 method, which prevents height: 100% from functio ...

What is the best way to position the hamburger menu icon on the right side of the header?

I need some assistance with adjusting the position of my mobile hamburger menu icon. It's currently on the left side of the screen, but I want to move it to the right. I've tried making the changes myself using CSS and HTML, but I'm not an e ...

Is there a way to apply textTransform to all components across the board?

I need to ensure that all text in my muiv5 project is capitalized by default, unless specifically overridden using sx or individual component styling. My attempted solution: <ThemeProvider theme={theme}> <IntlProvider locale="en& ...

What is the correct way to properly insert a display none attribute

I'm experiencing some alignment issues with the images in my slideshow. I used this example as a reference to create my slide: https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_slideshow_dots When clicking on the next image, it seems to mo ...

HTML Plant with background removed

I have been attempting to create a tree structure similar to the image provided. However, I am encountering difficulty in getting the background stripes to align properly for a specific row. When resizing the browser window, the stripes do not remain fixed ...

Effortless Sidebar Navigation for populating primary content

Initially, I must confess that even though this seems like a straightforward issue, I am just as puzzled as you are by my inability to solve it independently. With no prior experience in web development, I find myself in need of using GitHub Pages to docum ...

I have a flex box with an image and text line inside. How can I adjust the width of the box and text to automatically match the size of the image?

Consider the code snippet below: <style> .img_box { display: flex; } </style> <div class=img_box> <img src=img/> <div>Title text of varying length. It may exceed the image's width or be smaller.</div> & ...