Expanding an image and sliding in a div upon hovering

I am in need of assistance or guidance in the right direction.

My goal is to create an effect where an image grows when hovering over its parent DIV, while also having the background of the caption area slide in instead of fading in.

In the example provided below, you will see that the entire panel increases in size. If I use the .grow style, the image will only grow when hovered over directly, which is not exactly what I'm looking for. I want more of an overflow hidden effect.

This is the closest solution I could find but it's still not quite right.

Any help would be greatly appreciated!

Check out the example here

    <!-- HTML -->

<div class="content container ">
  <div class="row">

    <a href="#" id="panel-effect">
      <div class=" front-panel col-lg-3 col-md-3 col-sm-12">
        <div class="row">
          <div class="grow img-panel img-area-height" id="img1">
          </div>
          <div class="panel-txt-area">
            <p>blaaaaa</p>
            <div class="panel-title"><h3>TITLE &raquo;</h3></div>
          </div>
        </div>
      </div>
    </a>

    <a href="#">
      <div class=" front-panel col-lg-3 col-md-3 col-sm-12">
        <div class="row">
          <div class="img-panel img-area-height" id="img1">
          </div>
          <div class="panel-txt-area">
            <p>blaaaaa</p>
            <div class="panel-title"><h3>TITLE &raquo;</h3></div>
          </div>
        </div>
      </div>
    </a>

    <a href="#">
      <div class=" front-panel col-lg-3 col-md-3 col-sm-12">
        <div class="row">
          <div class="img-panel img-area-height" id="img1">
          </div>
          <div class="panel-txt-area">
            <p>blaaaaa</p>
            <div class="panel-title"><h3>TITLE &raquo;</h3></div>
          </div>
        </div>
      </div>
    </a>

  </div>
</div>
<!--container-->

<div style="margin-bottom:500px">
  <!--SPACER-->
</div>


<!-- CSS -->

.container{
  width:1270px;
}
body{
  background-color:#adafaf;
}

.front-panel{margin:0px 10px 10px 0px;}

.img-area-height{
  height:250px;
}

.panel-txt-area {
   height:180px;
  background-color:#fff;
  color:#000;
  padding:10px;
  position:relative;
}

.panel-txt-area:hover{
  background-color:#9eab05;
    color:#fff;
  -webkit-transition: all 0.25s ease-in-out;
      -moz-transition: all 0.25s ease-in-out;
      -o-transition: all 0.25s ease-in-out;
      -ms-transition: all 0.25s ease-in-out;
      transition: all 0.5s ease-in-out;

}

.panel-title{position:absolute;bottom:0;}

.img-panel {

  background-size:cover;
}

#img1{background-image: url(http://lorempixel.com/image_output/city-q-c-640-480-9.jpg);}

/*
.grow { transition: all .2s ease-in-out; }
.grow:hover { transform: scale(1.1); }*/

#panel-effect{
display: block;
/*width: 300px;
height: 300px;*/
-webkit-transform: scale(1,1);
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 250ms;
-moz-transform: scale(1,1);
-moz-transition-timing-function: ease-out;
-moz-transition-duration: 250ms;
}
#panel-effect:hover{
-webkit-transform: scale(1.05,1.07);
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 250ms;
-moz-transform: scale(1.05,1.07);
-moz-transition-timing-function: ease-out;
-moz-transition-duration: 250ms;
position: relative;
z-index: 99;
}

Answer №1

To implement the grow effect specifically for the background div, you will need to make some adjustments to the ID styles provided below in your style sheet.

#panel-effect .grow{
display: block;
/*width: 300px;
height: 300px;*/
-webkit-transform: scale(1,1);
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 250ms;
-moz-transform: scale(1,1);
-moz-transition-timing-function: ease-out;
-moz-transition-duration: 250ms;
}
#panel-effect .grow:hover{
-webkit-transform: scale(1.05,1.07);
-webkit-transition-timing-function: ease-out;
-webkit-transition-duration: 250ms;
-moz-transform: scale(1.05,1.07);
-moz-transition-timing-function: ease-out;
-moz-transition-duration: 250ms;
position: relative;
z-index: 99;
}

For a demonstration of how this works, check out the Demo link

Answer №2

Take a look at this fiddle... is this the solution you're looking for?

Here is an example to consider:

 <div class="wrapper">
  <a href="javascript:void(0)">
  <img src="http://files.braadmartin.com/gretsch-catalina-club-in-natural.jpg" width="250" height="250" />
</a>
<a href="javascript:void(0)">
  <img src="http://files.braadmartin.com/gretsch-catalina-club-in-natural.jpg" width="250" height="250" />
</a>  
<a href="javascript:void(0)">
  <img src="http://files.braadmartin.com/gretsch-catalina-club-in-natural.jpg" width="250" height="250" />
</a>
</div>

And here is the corresponding CSS:

 .wrapper {
  width: 250px;
  height: 250px;
  text-align: center;
}

.wrapper img {
  margin: 4% 0;
  height: 92%;
  width: auto;
}

.wrapper img:hover {
  margin: 0;
  height: 100%;
}

Check out the jsfiddle link for more information.

Answer №3

Is this the kind of effect you're looking for?: https://jsfiddle.net/2aLpw1hv/

HTML

<a href="#" id="panel-effect">
    <div class=" front-panel col-lg-3 col-md-3 col-sm-12">
        <div class="row">
            <div class="grow img-panel img-area-height" id="img1"></div>
            <div class="panel-txt-area">
            <p>blaaaaa</p>
            <div class="panel-title">
                <h3>TITLE &raquo;</h3>
            </div>
        </div>
    </div>
</a>

CSS

.front-panel {
  margin: 0px 10px 10px 0px;
  overflow: hidden;
  position: relative;
}

.img-area-height {
  height: 250px;
}

.panel-txt-area {
  width: 800px;
  height: 180px;
  padding: 10px;
  z-index: 99;
  background-size: 100% 200%;
  background-image: linear-gradient(to top, #9eab05 50%, #fff 50%);
  -webkit-transition: background-position 1s;
  -moz-transition: background-position
}

#panel-effect:hover .panel-txt-area {
  background-position: 0 100%;
}

.panel-title {
  position: absolute;
  bottom: 0;
}

.img-panel {
  background-size: cover;
}

#img1 {
  background-image: url(http://lorempixel.com/image_output/city-q-c-640-480-9.jpg);
}


/*
.grow { transition: all .2s ease-in-out; }
.grow:hover { transform: scale(1.1); }*/

#panel-effect .grow {
  /*width: 300px;
  height: 300px;*/
  -webkit-transform: scale(1, 1);
  -webkit-transition-timing-function: ease-out;
  -webkit-transition-duration: 250ms;
  -moz-transform: scale(1, 1);
  -moz-transition-timing-function: ease-out;
  -moz-transition-duration: 250ms;
}

#panel-effect:hover .grow {
  -webkit-transform: scale(1.05, 1.07);
  -webkit-transition-timing-function: ease-out;
  -webkit-transition-duration: 250ms;
  -moz-transform: scale(1.05, 1.07);
  -moz-transition-timing-function: ease-out;
  -moz-transition-duration: 250ms;
  position: relative;
}

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

Is there an issue with this piece of jQuery code?

function updateFieldFromUrl(url, param, field) { var anchor = document.createElement('a'), query; anchor.href = url; query = anchor.search.replace('?', '').split('&'); for(var i = 0, keyValue; i < qu ...

What is the best way to show a loading spinner as my Next image component loads, especially when there is an existing image already being displayed?

I'm trying to incorporate a loading spinner or any other HTML element while an image is being loaded. Currently, I am utilizing the ImageComponent to showcase images in a random movie generator. Although I managed to make the spinner work for the init ...

Can the unquoted HTML literal string syntax from scalatra be implemented in sinatra?

Is it possible to utilize this style in sinatra? get("/") { <html> <body> <h1>Hello, world!</h1> Say <a href="hello-scalate">hello to Scalate</a>. </body> </html> } I'm unsure i ...

PHP/Laravel Method for Tracking Date Changes Every 24 Hours

I have a task where I need to generate a report that fetches data totals from a MySQL database and displays them in table rows. Each row should represent the totals for a 24-hour time frame (from 9 pm one day to 9 pm the next day). The timestamps in my dat ...

Limited functionality: MVC 5, Ajax, and Jquery script runs once

<script> $(function () { var ajaxSubmit = function () { var $form = $(this); var settings = { data: $(this).serialize(), url: $(this).attr("action"), type: $(this).attr("method") }; ...

Extract the <img> element from the Angular model property

I'm currently leveraging Angular to display some HTML content: <p class="description" ng-model="listing.Description"></p> When the content is rendered, it includes images within the text, which is acceptable. However, now I aim to ident ...

Can HTML emails support vertical text direction?

Looking to craft an html email? Do you want to try implementing vertical text direction within a table of an html email, similar to this example: https://i.sstatic.net/sffna.png I'm specifically interested in making the text "Belgium SABE.LIX ...." ...

Creating a collection of footer buttons using CSS within Element UI

Struggling to recreate this layout using CSS, specifically with the footer buttons. https://i.sstatic.net/etG51.png Here's what I've achieved so far using the el-card component of Element UI and CSS: <el-card> <div style="cur ...

Mystery factor triggering the appearance of scrollbar as the window is resized to a specific width threshold

I'm facing a rather peculiar problem. I'm currently in the process of creating a webpage tailored for an iPhone screen resolution of: width: 640; height: 960; However, there seems to be a mysterious hidden element that is extending the width of ...

Having three adjacent divs with a full height and scrolling layout may not be compatible with all web browsers

After experimenting with various samples, I have managed to create a layout that works well in Chrome. However, I am facing compatibility issues with FireFox and IE. My goal is to set up 3 side-by-side divs with a height of 100% and a width around 30%. Th ...

I am looking to improve my form submission process by using JavaScript to only submit the form itself, rather than the

I have integrated JS and HTML code. The issue I am facing is that upon submission, the entire page is being submitted instead of just my form. function submit_by_id() { var name = document.getElementById("name").value; var email = document.getElementByI ...

Is it possible for a div element to maintain a fixed position even as its size changes

Looking to adjust the size of a ruler? In horizontal mode, the ruler expands and contracts as you resize it. However, in vertical mode, the ruler shifts left as you shrink it and right as you expand it. You can resize the ruler by dragging the small r ...

Slowly rendering spinner in Google Chrome using jQuery

When I click a button, I want to display a spinner to indicate that the browser is processing actions in the background. Interestingly, the spinner appears immediately after clicking the button on Firefox, but there is an 8-second delay before it shows up ...

Modify the alignment and orientation of the data within RadHtmlChart

I have a chart: <telerik:RadHtmlChart ID="chrtInvestmentAmount" runat="server" Transitions="true" DataSourceID="SqlDataSource1" Height="256px" Skin="Glow" Width="1024px" RenderMode="Auto"> <PlotArea> <Series> ...

What is the best way to implement the concept of setting a minimum size for a scrollable element based on its content and a

In the interest of simplicity, let's assume that my fixed height is 100px. So, the CSS expression for the question in the title would be: height: min(min-content, 100px); This means to take the minimum value between content height and 100px. Unfortun ...

What are some ways I can customize the appearance of a canvas element?

After discovering a canvas animation, I decided to customize it for my own needs. However, due to the fact that a canvas and its shapes are not DOM elements, I am struggling to style it properly. You can view my current progress here. When you hover over ...

Turn the flipcard hover effect into an onclick action

After successfully creating interactive flip cards using CSS hover effects, I am now faced with the challenge of adapting them for mobile devices. I'm struggling to figure out how to translate my hover effects into onclick events for a mobile-friendl ...

How to Customize the Placeholder Text of a TextField

When working with the TextField API, I noticed that there is no mention of how to style the pseudo placeholder element of the input element. I want to customize the default styling of the placeholder text, but the usual CSS tricks don't seem to work ...

What is the best way to incorporate a PHP variable into my Jquery image slider?

I've been experimenting with a Jquery Image slider and I'm interested in enhancing it further. My goal is to display two divs when the full-size image loads, one containing an image title and the other providing a description of the picture. How ...

Align several labels and text areas in the center

I am facing an issue with aligning multiple labels and textareas together. Currently, they line up like this: __________________ | | | | Label:|__________________| However, I want them to appear as fol ...