2016-05-14 72 views
1

我在網格列表中定位了絕對位置的div標籤,因此它被其他div的包圍。我想創建一個類,使絕對定位div的高度流動,直到遇到另一個類來修復(或關閉)絕對定位的div標記的高度!修復列表中絕對定位的div標籤的高度

或者找到一個解決方案給高度絕對定位div從前:第1行到第3行等?這裏是代碼:

jsFiddle

<div id="wrap_day_kalendar"> 
    <div id="day_kalendar" class="ui-selectable"> 
     <div class="row"><span>Saturday, 14 May 2016</span></div> 
     <div class="row dimgrey"><span>CEST +02:00</span></div>  

     <div class="row border-up"> 
      <div class="col-1 dimgrey text-right"><span class="">10 PM</span></div> 
      <div class="col-11 cornsilk selectable ui-selectee"><span>&nbsp;</span></div> 
     </div> 
     <div class="row"> 
      <div class="col-1 dimgrey fix-border">&nbsp;</div> 
      <div class="col-11 border-up-dashed cornsilk selectable ui-selectee"> 
       <span>&nbsp;</span> 
       <span class="newevent">New event</span> 
       <span class="newevent">Second event</span> 

      </div> 
     </div> 
     <div class="row border-up"> 
      <div class="col-1 dimgrey text-right"><span class="">9 PM</span></div> 
      <div class="col-11 cornsilk selectable ui-selectee"><span>&nbsp;</span></div> 
     </div> 
     <div class="row"> 
      <div class="col-1 dimgrey fix-border">&nbsp;</div> 
      <div class="col-11 border-up-dashed cornsilk selectable ui-selectee"><span>&nbsp;</span></div> 
     </div> 
    <div class="row border-up"> 
     <div class="col-1 dimgrey text-right"><span class="">7 PM</span></div> 
     <div class="col-11 cornsilk selectable ui-selectee"><span>&nbsp;</span></div> 
    </div> 
    <div class="row"> 
     <div class="col-1 dimgrey fix-border">&nbsp;</div> 
     <div class="col-11 border-up-dashed cornsilk selectable ui-selectee"><span>&nbsp;</span></div> 
    </div> 
    </div> 
</div> 
+0

我不能讓你的觀點花花公子。你的意思是'@media query'? – winresh24

+0

我需要div在固定網格上流動,但不知道高度,從第一排到第三排,例如。 –

+0

這樣? https://jsfiddle.net/p5hykd0x/2/對不起,我不明白你的觀點請詳細說明 – winresh24

回答

2

使用Javascript/jQuery的,你可以得到父DIV和X後續的div的高度(如果你通過這個與.COL-11的div迭代案件),那麼你設置你的div的高度。

這裏,如果你想要讓所有.newevent格當前單元格高度3倍(笨)例如:

$(document).ready(function() { 
     $('.newevent').each(function() { 
      var parentHeight = parseInt($(this).parent().css('height')); 
      $(this).css('height', 3 * parentHeight + 'px'); 
     }); 
    })