2010-12-06 73 views
1

我在div上有5個圖像(如產品的拇指圖像)。而且我還有另外一個div,並附有簡短的標籤部分。通過點擊另一個div中的圖像顯示div(具有樣式「display:none」)

我的編碼(如下面):

  1. 分度,5個圖像。
  2. 另一個分部有5個選項卡部分及其產品詳細信息。
  3. 另外,第二個div有財產style"display:none"。我想讓它看到它的詳細的div部分點擊拇指。

在此先感謝。

+2

一些HTML會很好。 – 2010-12-06 17:59:09

回答

2

您可以使用.show().hide()來切換'display:none'來顯示/隱藏div。

+1

更好,您可以使用.toggle()切換顯示。 :) – bozdoz 2010-12-06 18:06:03

0

我的回答只能和你的描述一樣。

$("#theDivToBeClickedOn").click(function(){ 
     $("#theDivWhereImageIs").show(); 
}); 
0

我假設你有一個有具體形象的描述,所以你必須顯示/隱藏他們太多其他一些標籤。

$('#div1 img').click(function(){ //when you click on the thumb in the first div 
     var i = $('#div1 img').index(this); //get index of thumb to correspond to image 
     $('#div3').toggle(); //show third div 
     $('#div3 div').eq(i).toggle(); //show the particular thumb's description 
});