2013-07-16 40 views
0

我使用JQuery slideDown的方法來顯示和隱藏div從它滑下後面的頁面上的其他內容的事實上除了工作遠遠落後。我曾試圖改變divz-index,但它沒有什麼區別,儘管它隱藏背後的divs沒有z-index規則和所有其他的造型我申請了它的工作。了slideDown格顯示其他的div

添加z-index到正確顯示所做的圖像。

我的js ..

<script> 
$(document).ready(function(){ 
    $(".close1").click(function(){ 
    $("#what_is_audit_control").slideUp(); 
    }); 
    $(".slide_down_1").click(function(){ 
    $("#what_is_audit_control").slideDown(); 
    }); 
}); 

的HTML ...

<div id="what_is_audit_control" 
     style="display:none; border-style:solid;border-color:#666;border-width:thin;width:600px; margin-left:20px;"> 
      <p>I hope this works</p><br/> 
      <p class="close1">close</p> 
</div><!--what is audit control--> 
<img id="audit_control_main_tab" class="slide_down_1" src="images/tabs/audit_control_main.gif" alt="What is audit control?" style="z-index:99999999999" /> 

的內嵌樣式將被移動到CSS的網頁我有它工作正常

+0

似乎在這裏很好http://jsfiddle.net/arunpjohny/sXW7j/1/ –

回答

1

你有後改變元素上的位置。 z-index只適用於絕對和相對。

嘗試:

<div id="what_is_audit_control" 
     style="display:none; border-style:solid;border-color:#666;border-width:thin;width:600px; margin-left:20px; position: relative; z-index: 2000"> 
      <p>I hope this works</p><br/> 
      <p class="close1">close</p> 
</div><!--what is audit control--> 
<img id="audit_control_main_tab" class="slide_down_1" src="images/tabs/audit_control_main.gif" alt="What is audit control?" style=" position: relative; z-index:1000" /> 
+0

感謝。 IMG是好的,是沒有工作的股利,但我改變了立場,而不是工作。 – tatty27

+0

是的,我意識到,當我讀它近一點。現在代碼是正確的,我猜。 :) – Lundeman

+0

作品感謝 – tatty27