Below is the code snippet provided: https://jsfiddle.net/wc48jvgt/69/
The situation involves a div with a horizontal layout named #cleaning_card_1
, containing embedded divs that act as borders, and a vertical div called #cleaning_card_right_1
with a nested div #cleaning_card_right_content_1
. Within this final div
are multiple dynamic amount of divs
. The objective is to make #cleaning_card_right_1
function like a dropdown menu. A simple function has been created for this purpose:
function maximizeCleaningCard () {
var cleaning_card_number = $(this).attr('number')
$(this).animate({width: '97%'}, 200, function () {
$('#cleaning_card_right_' + cleaning_card_number).removeClass('cleaning_card_right').addClass('cleaning_card_right_maximized')
$('#cleaning_card_right_' + cleaning_card_number).animate({height: 400}, 400)
$('#cleaning_card_right_content_' + cleaning_card_number).animate({height: 400 - 80}, 400)
$('#cleaning_card_right_left_border_1, #cleaning_card_right_right_border_1').animate({height: 400 - 80}, 400)
})
}
$('.cleaning_card').click(maximizeCleaningCard)
While the animation runs smoothly on #cleaning_card_1
and border divs
, the issue arises with the animation of #cleaning_card_right_content_1
. It appears suddenly without any animation. Removing nested items allows the animation to work correctly. The assumption is that the height of the div
is not zero due to the nested elements causing the problem. How can this issue be resolved?