Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Rotating card height with collapse

lassekofoed free asked 4 years ago


Expected behavior When a collapse is unfolded the card height expands with it.

Actual behavior Card wrapper stays same height

When using a collapse element inside a rotating card, the card-wrapper height is not updated.

Resources (screenshots, code snippets etc.)

This helped me:https://mdbootstrap.com/support/jquery/rotating-card-height/Using the code giving above, I handle it this way

$('.card-rotating .collapse').on('hidden.bs.collapse', function () {
    AdjustCardWrapperMinHeight($(this).parents(".card").attr("id"));
});

$('.card-rotating .collapse').on('shown.bs.collapse', function () {    
    AdjustCardWrapperMinHeight($(this).parents(".card").attr("id"));
});

function AdjustCardWrapperMinHeight(cardId) {
    var frontHeight = $("#" +cardId).find("div.front:first").height();    
    var backHeight = $("#" + cardId).find("div.back:last").height();

    var height = frontHeight;
    if (backHeight > height) {
        height = backHeight;
    }
    //My minimum height had to be 500.
    if (height < 500) {
        height = 500;
    }
    $("#" + cardId).parents("div.card-wrapper").css("min-height", height);
}

As the event used is when animation is done, there is no smooth transition.Maybe this should be part of the Core ?


Mateusz Łubianka staff commented 4 years ago

Hi @lassekofoed, please, create a snippet showing your problem here: https://mdbootstrap.com/snippets/. I'll try to help you.

Best,



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.14.0
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: Yes