Friends,
I have a little project and two columns in my div and I want to make equal these divs if right div bigger than left div so I wrote a code for that it’s work as I want but in my project it’s not going to work properly why I didn’t understand.
and I want to share my demo
as you see my image height is: 169px and my right divs height is: 193px so where is my mistake you think ?
function getListHeight() {
$(".tur-list .col-lg-5 img").each(function() {
var getTurHeight = $(this).parents(".tur-list").find(".col-lg-7").outerHeight();
var getLeftHeight = $(this).parents(".tur-list").find(".col-lg-5 img").outerHeight();
if (getTurHeight > getLeftHeight) {
$(this).outerHeight(getTurHeight);
}
});
}
$(document).ready(function(){
getListHeight();
});
.box{
width:700px;
margin:30px auto;
}
.tur-list{
border:1px solid #ccc;
margin-bottom:15px;
}
img{
width:100%
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box">
<div class="box">
<div class="tur-list">
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
<figure>
<img src="http://content.anitur.com/web/images/240x220/2016-12/yurtdisi_tur_Sq4MvAMnDGjz7rAgEaOIbalkan-sehirleri-turu-4.jpg"/>
</figure>
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
<div class="tur-list-title">
<h3>This is the title</h3>
<p>p of title</p>
</div><!-- title -->
<div class="tur-location">
<p>Netherlands</p>
</div><!-- location-->
<div class="tur-list-detay">
<p>some details here</p>
</div><!-- detail-->
<div class="tur-bottom-detay">
<a href="#">Link of box</a>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis unde voluptatibus ea, possimus totam blanditiis molestiae doloremque ipsa magni maiores fugit? Impedit expedita aspernatur dignissimos ipsa consectetur accusamus praesentium, saepe, fugit incidunt doloribus. Maxime expedita nesciunt, magni accusamus culpa saepe cupiditate tempora cum soluta natus, ea illo quo! Nulla error repudiandae natus vel dicta sequi molestias, possimus optio a dolore laboriosam eligendi impedit nam dolorum! Temporibus necessitatibus alias ullam reiciendis ipsam id quisquam, repudiandae? Quas doloremque, laboriosam quaerat sed veniam, dolores ea aspernatur velit, accusamus eligendi soluta rerum architecto cum fuga? Explicabo assumenda quisquam laudantium quae laborum voluptatem alias harum!</p>
</div><!-- bottom detail-->
</div>
</div>
</div>
<div class="tur-list">
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
<figure>
<img src="http://content.anitur.com/web/images/240x220/2016-12/yurtdisi_tur_Sq4MvAMnDGjz7rAgEaOIbalkan-sehirleri-turu-4.jpg"/>
</figure>
</div>
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
<div class="tur-list-title">
<h3>This is the title</h3>
<p>p of title</p>
</div><!-- title -->
<div class="tur-location">
<p>Netherlands</p>
</div><!-- location-->
<div class="tur-list-detay">
<p>some details here</p>
</div><!-- detail-->
<div class="tur-bottom-detay">
<a href="#">Link of box</a>
<p>another thinks.. bla bla..</p>
</div><!-- bottom detail-->
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
2
Answers
There are many ways to do this, but non will be easy.
One way to do it, with no need to use JavaScript/jQuery:
The concept as following:
Here’s a demo.