次の順序付けられていないリストが与えられた場合、マウスアウト イベントでリストを非表示にします。
この行 $(this).css ('display','none') ; コメントアウトされていますが、マウスがリストに出入りすると背景の色が変わるという期待どおりの動作です。
ただし、その行のコメントを外すと、マウスアウトイベントで UL が消えることが予想されます。代わりに、マウスがリストに移動するとすぐに消えます。
私はこれで6時間過ごしました。私は何が欠けていますか?
ありがとう、
マック
<style type="text/css">
* {
color: navy;
font-family: arial;
font-size: 18px;
}
ul, li {
padding: 0;
margin: 0;
list-style: none;
}
ul#member {
position: absolute;
left: 10px;
top: 0px;
//clear: left;
border: 1px solid red;
padding: 4px;
margin-left: 10px;
margin-top: 10px;
display: block;
line-height:1.5;
}
</style>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script>
$(document).ready(function() {
//alert ('jQuery Is Alive and Well');
$('ul#member').mouseover (function() {
$(this).css('background-color','silver');
});
$('ul#member').mouseout (function(){
$(this).css('background-color','gray');
// $(this).css ('display','none');
});
}); //end of document ready
</script>
</head>
<body>
<ul id='member'>
<li>Change Villages ID#</li>
<li>Change Address</li>
<li>Changes Phone Numbers</li>
<li>Change Name</li>
</ul>
</body>
</html>