jquery - Adjust the height of table column based on the content inside it -


how adjust height of td based on iframe height. tried height:auto, doesn't work. each iframe has different content , hence height differs

i using content carousel switch between 1 iframe other.

initially happens content carousel animates automatically switching between each iframes. , lands @ first iframe. user can use carousel navigation switch between iframes.

<td class="tabcontainer"> <div id="multipleiframe"> <iframe></iframe> <iframe></iframe> <iframe></iframe> <iframe></iframe> </div> </td> 

below code using change height of each iframe , td height.

settimeout(function() { $("#multipleiframe iframe").each(function() { var heightiframe; heightiframe = $(this).contents().height(); $(this).css({     "height": heightiframe }); var tabheight; tabheight = heightiframe + 50; $(".tabcontainer").css({"height":tabheight+"px"}) }); }, 3000) 

can solve this?

the tabheight value set heightiframe in each iteration. place outside loop.

settimeout(function() {   var tabheight=0; // set 0 , outside loop   $("#multipleiframe iframe").each(function() {     var heightiframe = $(this).contents().height();     $(this).css({       "height": heightiframe + "px" <--- add "px" here     });     tabheight += heightiframe + 50; // add each iframe's height tabheight   });   $(".tabcontainer").css({"height":tabheight+"px"}); // apply tab height }, 3000); 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -