Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".imgContainer img").load(function(){
- var imageHeight = $(this).height();
- console.log(imageHeight);
- $(".parentDiv").css('min-height',imageHeight);
- $(".parentDiv .anotherDiv").css('height',imageHeight);
- });
- $(window).resize(function() {
- var imageHeight = $(".imgContainer img").height();
- $(".parentDiv").css('min-height',imageHeight);
- $(".parentDiv .anotherDiv").css('height',imageHeight);
- });
- <div class="parentDiv">
- <div class="imgContainer">
- <img src="test.jpg" />
- </div>
- <div class="anotherDiv"></div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement