css - Jquery Expand Height with text overflow -


i'm trying have div's height expand automatically when contained text overflows. here my code on jsfiddle. isn't exact environment need function same concept. need jquery work , switch classes. appreciated.

<div class="box">hello</div> <br> <div class="box">text long</div>  .box { height: 30px; width: 50px; background: #666; } .boxfix { height: 60px; width: 50px; background: #666; }  var heightcheck = $(".box").height();  if (heightcheck > 30) { $('.box').removeclass('box').addclass('boxfix'); } 

update: guess wasn't super specific, have attached 2 images show issue. not need extend height, "line-height" css property well. that's why figured changing class in jq work.

in response fiddle linked in comments (jsfiddle.net/4nfne/6), set height , min-height in same block...

color: #696969; height: 23px; line-height: 17px; text-transform: uppercase; text-decoration: none; display: block; padding-left: 6px; margin-bottom: 12px; letter-spacing:1px; min-height: 36px; 

changing 'height' 'min-height' , removing existing 'min-height' works fiddle.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -