2013-06-25 38 views
2

我試圖找到一個下拉像谷歌搜索設置下拉點擊按鈕或鏈接來打開跌落淹死像谷歌

下面是示例圖像:

enter image description here

是否有像任何演示這樣我可以在我的網站或方式來建立這個?我只需要基本功能主義者,點擊按鈕/鏈接打開下拉菜單。我可以給樣式。我在jquery中很糟糕,這是很難做到的。

如果有任何解決方案將是偉大的。

+0

你給出的圖像路徑是說blockpage – pixelbyaj

+0

+1爲「Drop Drown」:-) – CodeZombie

回答

2

您可以通過使用.toggle()函數在齒輪點擊時顯示和隱藏它。

$(function(){ 
    $('#gear').click(function(){ 
     $('#dropdown').toggle(); 
    }); 
}); 

Simple demo (click the box)

+0

這是完美的。我可以修改這個爲我的使用。非常感謝你 –

+0

你能幫助我另一個功能。 IT是當我點擊任何其他地方時,下拉應該消失。這是可能的任何功能? –

+0

@SRaihan當然,看到這個小提琴:http://jsfiddle.net/58kBY/3/ – Andy

0
try this. 

**html** 
<div id="drop">drop<div id="dropdown"><a>xxxxxxx</a><hr/><a>yyyyyyyy</a><hr/><a>zzzzzzz</a></div></div> 

**css** 

#drop { 
    margin: auto; 
    width: 40px; 
    height: 30px; 
    border: 2px solid ; 
    position: relative; 
    background-color:green; 
    border-radius:4px; 
    cursor:pointer; 
    } 

#dropdown { 
    position:absolute; 
    top: 30px; 
    right: -1px; 
    width: 150px; 
    height: 100px; 
    border: 1px solid; 
    display: none; 
    text-align:center; 
    border-radius:4px; 
    cursor:pointer; 
} 

**script** 

$(function(){ 
    $('#drop').click(function(){ 
     $('#dropdown').toggle(); 
    }); 
});