2012-03-06 16 views
1
<div class="langs"> 
    <div class="flag"><h3>Country</h3> 
     <img id="flag" src="../media/images/flags/en.png"/> 
    </div> 
    <select class="select_country" name="country" id="select_country"> 
    <option>United States</option> 
    <option>Spain</option> 
    <option >France</option> 
    </select> 
    </div> 

のjQuery:jqueryのショー非表示選択オプションブロック

$(".langs").hover(function() { 
    $("#select_country").slideToggle('500').css({"display":"block"}); 

    }); 

私はマウスオーバーで文句を言わない選択ブロックを表示し、国を選択した後は、選択オプションのブロックを非表示にします。

答えて

0

このようなものはありますか?

$(".langs").mouseenter(function() { 
    $("#select_country").show(); // SHOW #select_country on mouse over 
}); 

$(".langs").mouseleave(function() { 
    $("#select_country").hide(); // HIDE #select_country on mouse out 
}); 

あなたはまた、(代わりに.SHOWの.slideDown().slideUp()を使用したい場合があります)と.hide()

例:http://jsfiddle.net/xUWK6/1/

+0

[OK]をはFirefoxで作業していて、動作しません。 IEとGoogle Chromeで! –

+0

代わりに '.mouseover()'と '.mouseout()'を使用しようとしていますか? – Fabian

+0

私はselect->オプションをul-> liタグに変更しました。IEとChromeのselect-> optionを使って正しく動作しません。 –

0
//By default hide the select box 
$("#select_country").hide(); 

//On mouseover it will show the select box 
$(".langs").mouseover(function() { 
    $("#select_country").show(); 
}); 

//Once you change the selection it will hide itself 
$("#select_country").change(function(){ 
    $(this).hide(); 
}); 
関連する問題