The transition animations on a mouseover accordion effect are not smooth

Looking to set up a simple website for a project that fetches data from a server using AJAX and displays it as depicted in the image? The issue isn't with JavaScript but rather with pure HTML+CSS.

To view this page on jsfiddle, you can click here. Alternatively, you can check out the code provided at the end of this post.

The list is generated using the following html snippet:

<div id="update">
    <ul class="searchresults">
        <li>
            <h2>Caption</h2>
            <div>
                <img src="" alt="" />
                <p>Text</p>
            </div>
        </li>
    </ul>
</div>

The formatting is done via CSS, but the crucial part is as follows:

#update ul li {
    height: 110px;
    overflow: hidden;
    /* ... */       

    /*
    -webkit-transition: height 0.3s ease-out;
    -moz-transition: height 0.3s ease-out;
    -o-transition: height 0.3s ease-out;
    transition: height 0.3s ease-out;
    */
}

#update li:hover {
    height: auto;
}

This setup works well when transitions are kept commented out. Hovering over the item scales its height to "auto", accommodating exactly the content's height. However, if the transitions are uncommented, WebKit browsers like Chrome 30 and Safari 6 exhibit a shaky effect rendering it unusable. For an uncommented version, visit this jsfiddle link: http://jsfiddle.net/bQZ7F/

In Firefox 23 and Opera 12, this transition is disabled causing it to disregard the presence of the CSS portion.

HTML:

(previously mentioned code block for HTML)

CSS:

(previously mentioned code block for CSS)

Answer №1

Thank you for the clue, it appears that achieving this without JavaScript is not feasible:

Apply these CSS settings

#update ul li {
    height: 110px;
    /* ... */
}

#update li:hover {
    background: #FFFCE5;
}

The concept of the JavaScript code is as follows:

// Mouse-enter Event
curHeight = $(this).height();
autoHeight = $(this).css('height', 'auto').height();

$(this).height(curHeight).animate({height: autoHeight}, 1000);

// Mouse-leave Event
// same, but in reverse

You can access the complete code here: http://jsfiddle.net/9eaAq/

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

When the value in a required input field is empty, the border is activated and the color is styled

Can you please explain this to me? Try running this code in Firefox: http://jsfiddle.net/eMa8y/24/ Here is the HTML: <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> </head> ...

Using AngularJS to apply conditional ngClass styling

Is there a method to create a conditional expression similar to ng-class? For instance, I attempted the following: <span ng-class="{test: 'obj.value1 == \'someothervalue\''}">test</span> The problem with this co ...

Exploring the depths of HTML with the Agility Pack

Looking to extract specific elements from my HTML code: <div id="mailbox" class="div-w div-m-0"> <h2 class="h-line">InBox</h2> <div id="mailbox-table"> <table id="maillist"> <tr> ...

CSS Positioning of Fixed/Absolute <div>

Is there a way to keep a div fixed at the bottom of the viewport by using position: fixed; bottom: 0;, then switch it to position: absolute; bottom: 0; when scrolling reaches the footer? I need the div to remain at the bottom of the viewport initially, an ...

What is the best way to adjust the font size for a bootstrap-select dropdown menu?

I attempted to create a new CSS class to customize the appearance of the dropdown menu, but unfortunately, it doesn't seem to be taking effect. #form.py class fundForm(forms.Form): fund = forms.ChoiceField(choices=FUND, required=True, widget=for ...

What is preventing me from adjusting the width of an image that extends outside of its parent container, even though I am able to modify the height?

I am facing an issue with a div on my website that has specific properties: #viewport{ overflow: hidden; display: block; position: relative; width: 323px; height: 323px; } Embedded within this div is an element with the following prop ...

Is there a way for me to customize the appearance of the drop-down panel in a select box to feature rounded corners specifically for the Chrome browser?

Hey there! Currently working on an Angular 5 application where I need to style a select box with rounded corners for the options panel in Chrome. Would appreciate any tips or suggestions on achieving this using CSS styles. Please refer to the image linked ...

Issue with negative margin not functioning properly in Internet Explorer 7

My code snippet looks like this: <style> .earthlogo{float: right; margin: -270px 0px 0px 0px;} </style> <div class="banner"> <p>ENVISIONING A BETTER TOMORROW</p> <div class="earthlogo ...

Setting the Disabled and Checked attributes on HTML Elements based on certain conditions

Within an asp GridView template field, there is a button and a checkbox. The goal is to set the disabled property of the button and the checked property of the checkbox based on the Data Field Expiration conditionally. If the Expiration equals Permanent, t ...

Is there a way for me to remove an uploaded image from the system

Here is an example of my HTML code: <input type='file' multiple/> <?php for($i=0;$i<5; $i++) { ?> <div class="img-container" id="box<?php echo $i ?>"> <button style="display: none;" type="submit" cl ...

Learn how to create a button that will only submit a value when clicked using Node.js and EJS

Currently in my ejs file, I have a button that sends a value to app.js instantly when the program runs. However, I want it to only submit the value when clicked by the user. <% notesArray.forEach((note,i) =>{ %> <div class="note"> ...

Utilize the ng-controller directive with unique aliases across various sections of HTML code

I'm facing an issue with my ng-controllers when multiple controllers are used on the same page. For instance, I have one controller in the page header, another in a different section of the same page, and one in the content of the page. However, all o ...

Design an HTML table with each row represented by a form element

I'm attempting to design a table where each row serves as a form. I would like each input to be in a separate table division, but I also need all the first inputs to belong to the same table header, and so forth. My goal is to create an editable grid ...

Emphasize multiple anchor points

I am looking to highlight two sections of a page simultaneously. Here is what I currently have: <li class="langLI" style="list-style-type:none"><a href="/non-discrimination-and-language-assistance##French">| French Creole</a></li> ...

Can you use ng-show within ng-if in Angular?

How can I make this input only show a property is true per the ng-if? The current code looks like this: <input type="button" class="naviaBtn naviaBlue" ng-if="ppt.Globals.hasDebitCard" ng-click="alertShow = (alertShow == 2 ? -1 : 2)" value="outstandin ...

Looking to retrieve a specific data element within Vue.js?

Here's a thought-provoking query for you. Imagine I have some data stored in an element in the form of an array like this: data: { product: socks, variants: [ { variantId: 2234, variantColor: 'Green', varian ...

The wells are surpassing the line

I'm attempting to arrange 3 Wells horizontally in one row, as shown below <div class="row" style="margin-top: 10px"> <div class="span4 well"> <h3 class="centralizado"><img src="/assets/temple.png" /> & ...

"Enhance your website with captivating Javascript hover effects for

Can anyone assist me with incorporating the navigation hover effect seen on this website into my HTML/CSS project? The example site is built using a WordPress theme, but I am looking to apply that green effect to my own webpage and have the ability to cust ...

Using JavaScript to implement responsive design through media queries

The code seems to be having some issues as it only works when I reload the page. I am looking to display certain code if "size < 700" and other code if "size > 699". I also tried this code from here: <script> function myFunction(x) { if ( ...

The div inside another div does not appear centered on Safari

Even though I've managed to center a div within another div, it seems to not be functioning properly in the Safari browser. #box{ width: 100%; height: 100%; position: relative; } ...