Interactive carousel featuring responsive image zoom effect on hover

Utilizing the flickity carousel, I have crafted an example which can be found at this link to codepen.io. Here is the CSS code that has been implemented:

CSS

.image-hoover { 
  overflow: hidden;
}

.image-hoover img {
 -moz-transform: scale(1.02);
  -webkit-transform: scale(1.02);
  transform: scale(1.02);
  -webkit-transition: all 10s ease;
  -moz-transition:    all 10s ease;
  -o-transition:      all 10s ease;
  -ms-transition:     all 10s ease;
  transition:         all 10s ease;
}


.image-hoover:hover img {
  -moz-transform: scale(1.06);
  -webkit-transform: scale(1.06);
  transform: scale(1.06);
  -webkit-transition: all 10s linear;
  -moz-transition:    all 10s linear;
  -o-transition:      all 10s linear;
  -ms-transition:     all 10s linear;
  transition:         all 10s linear;
}

The challenge I am facing is that the images are losing their responsive behavior when I deactivate this segment:

.image-hoover img {
 -moz-transform: scale(1.02);
  -webkit-transform: scale(1.02);
  transform: scale(1.02);
  -webkit-transition: all 10s ease;
  -moz-transition:    all 10s ease;
  -o-transition:      all 10s ease;
  -ms-transition:     all 10s ease;
  transition:         all 10s ease;
}

However, without it, when unhovered, the image quickly returns to its original size, losing the desired transition effect. Can you offer any suggestions on how to resolve this issue?


1. In this example, the responsive behavior of the image remains intact, but the hover zoom effect loses its smooth transition.

2. Check out this example where the transition effect works well, but resizing the window leads to a loss of the image's responsive nature.

Answer №1

The reason for this issue is because you have set the transition to apply to all actions, causing the 10s transition to occur even when the images change or when the screen width changes.

To resolve this, you should update the code as follows:

-webkit-transition: -webkit-transform: 10s ease;
  -moz-transition:    -moz-transform 10s ease;
  -o-transition:      transform 10s ease;
  -ms-transition:     transform 10s ease;
  transition:         transform 10s ease;

Additionally, remove the transition from the :hover state to ensure it works properly.

You can see the updated code in action here: http://codepen.io/anon/pen/eJWQRq?editors=110

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

Guideline on extracting private keys from Windows Certificate Manager

I am currently working in a Windows environment setting. Within my organization, we act as our own certificate authority for internally-used https applications. I have obtained a certificate from our system for a private web server I created. While using ...

What is the reason that columns do not float in Bootstrap when there are no rows?

I have been doing some research into Bootstrap and have come across the following resources: What is the purpose of .row in Bootstrap? and Despite reading these links, I am still struggling to understand why my columns do not float left as expected in th ...

Extracting Json data with Jquery

My JSON data format is as follows - I've been struggling to find a way to retrieve the photo reference value. Can anyone help me with this? { "debug_info" : [], "html_attributions" : [ "Listings by \u003ca href=\"http://www.yellowpages. ...

What is the extent to which a scope variable will be accessible within the link function of Angular?

var $directive = angular.module('myApp', []); $directive.directive('myDirective', function(){ return { restrict: 'E', template: '<h4>{{title}}</h4>' compile: function(element, attrs){ ...

"Implementing a feature in React JS react-table to dynamically add a new column when a

I'm struggling to add a new column to react-table when a button is clicked. Even after re-rendering the table with a flag, I can't seem to add the new column. Can anyone suggest where I might be going wrong? Here's the link to the executable ...

How can I prevent Sundays from being selected in a jQuery datetimepicker?

I'm currently working with a jquery datetimepicker and my goal is to exclude Sundays from the selection. How can I achieve this? Below is the jquery code that I am using: $(".datetimepicker").datetimepicker({ format: 'm-d-Y H:i', defaultD ...

How can I ensure the button remains disabled until all inputs are completed in Redux form?

I am currently studying a react-redux form example that you can find at the following link: In this example, the submit button is enabled if the user fills in at least one input field. I am curious to know if there is a way to enable the button only when ...

Creating a Sticky Header and Footer with Responsive Design: Ensuring Content Div Expansion between Them

Greetings. I am working on creating a simple responsive HTML layout as described below: HTML: <div id="header"></div> <div id="content"></div> <div id="footer"></div> CSS: #header{ wi ...

Font malfunctioning on Microsoft Edge and Internet Explorer

Apologies if this seems like a silly question, but I recently imported a font from my computer into a CSS file. While it displays correctly in Chrome, it's not working in Microsoft Edge or Internet Explorer. Unfortunately, I don't have access to ...

Angular JS Visibility Toggling with Ng-Show and Ng-Hide

Working on an angular service for a login form, I've successfully implemented authentication using a factory with an http injector to handle HTTP credentials. However, I'm facing an issue in displaying an error message when incorrect credentials ...

Issue with MUI Autocomplete not showing selected name on initial option selection

I encountered a strange issue with the Autocomplete component from Material UI. Here is the code snippet in question: const [isContactListInitialised, setContactListInitialised] = useState(false); const toggleContactListInitialized = () => { setContactL ...

Adjust top position dynamically during resizing

When resizing the window, I am facing an issue with the image going outside of the box. I believe adjusting the position top of the image based on the box height might help in fitting the image properly within the box. $(window).resize(function() { va ...

Error: The function user.comparePassword does not exist or is not defined

I am facing an error that says TypeError: user.comparePassword is not a function. I have ensured that all dependencies are installed and the APP is linked to all the libraries. I tried using Postman to retrieve data, but it doesn't seem to be workin ...

PHP Ajax login form to instantly authenticate without redirecting to a new page

After attempting to implement Ajax in my login form by following two different tutorials, I am still facing the issue of error messages redirecting to another page instead of displaying on the same page. I have tried to troubleshoot and compare my code wit ...

Maintaining a Multi-page template in PhoneGap: Best practices

I'm a beginner in Hybrid app development, currently using PhoneGap and Jquery Mobile. In my app, I have around 10 separate pages such as login.html, index.html, search.html, etc. My query is whether I should include all JS and CSS files on each indivi ...

Is there a way I can align these items in the center of the span?

Issue at Hand: The SVG and text elements are not aligning to the center of my spans as desired. Attempts Made: I have experimented with different display modes, used margin properties for alignment, and tried adjusting text-align. I even searched for so ...

Error message: JQuery IAS Infinite Scrolling + Packery - The IASCallbacks function is not declared

I'm having difficulty integrating Packery with Jquery Infinite AJAX scroll on a Tumblr theme. I keep getting the error "Uncaught ReferenceError: IASCallbacks is not defined" and I can't figure out why. Here's the code I've put together ...

Updating image URL for grouped objects with Fabric JS

Check out this link :http://jsfiddle.net/mishragaurav31/ang58fcL/#base I created two groups of objects; one consisting of a circle and text, and the other with two images. When I try to change attributes for group 1, it works fine. However, when attempt ...

Fetching DOM elements proved to be faster than using jQuery AJAX in this instance

Using AJAX and jQuery, I am trying to verify if a username is available for registration. Below is the input field for registration: <tr> <td><input type = "text" id ="new_username"/></td> </tr> ...

Troubleshooting HTML/JavaScript with JSP and JSTL: iPhone only displaying the first option in select dropdown, rather than the selected option

My HTML includes a <select> element: <select id="mySelect"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> ...