Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. $(".imgContainer img").load(function(){
  2. var imageHeight = $(this).height();
  3. console.log(imageHeight);
  4. $(".parentDiv").css('min-height',imageHeight);
  5. $(".parentDiv .anotherDiv").css('height',imageHeight);
  6. });
  7.  
  8. $(window).resize(function() {
  9. var imageHeight = $(".imgContainer img").height();
  10. $(".parentDiv").css('min-height',imageHeight);
  11. $(".parentDiv .anotherDiv").css('height',imageHeight);
  12. });
  13.  
  14. <div class="parentDiv">
  15. <div class="imgContainer">
  16. <img src="test.jpg" />
  17. </div>
  18. <div class="anotherDiv"></div>
  19. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement