Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Dinamic resizing of content not working on smart wizard plugin

consider the following jquery function:

$(document).ready(function () {
        $('#add-product').click(function () {
            $("<div class='row'> <div class='col'> <div class='form-group'><input type='text' class='form-control products' placeholder='Product name'> </div> </div> </div>").appendTo($('.products'))
        })
        $('.tab-content').height('100%')
    })
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button id='add-product'> click me </button>
<div class='products'>
</div>

the previous appends an input field inside the .tab-content, it works but the size of the content container doesn’t change dynamically, only changes when i go to next step then return to previous step

tried messing with the parameters on plugin init such as:
justified: true or false, autoAdjustHeight: true or false
also tried adding style = "height:100% or auto" to DOM, nothing seems to work

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Can you try this :

$('.tab-content').height('100%') ; must be inside the click function

$(document).ready(function () {
        console.log("height before : "+ $(".tab-content").height() );
        $('#add-product').click(function () {
            $("<div class='row'> <div class='col'> <div class='form-group'><input type='text' class='form-control products' placeholder='Product name'> </div> </div> </div>").appendTo($('.products'))
        
          $('.tab-content').height('100%') ;
          console.log("height after : "+ $(".tab-content").height() );
        })
    })
.tab-content {
   height : 50%
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button id='add-product'> click me </button>

<div class='tab-content'>
  <div class='products'>
  </div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading