close
hover(over,out)其實也就是定義好的onMouseOver、onMouseOut
Ex:
<style type="Text/Css"> .to_mouseOver {
background-Color:red;
color:white;
} .to_mouseOut { background-Color:white; color:black; } </style>
<script
$(document).ready(function(){ $('div').hover( function() { $(this).addClass('to_mouseOver');
},
function()
{
$(this).removeClass('to_mouseOver');
} );
$('#myGrid tr').hover(
function()
{
$(this).addClass('to_mouserOver');
} ,
function()
{
$(this).removeClass('to_mouserOver');
} );
})
</script>
<div> 選項一 </div>
<div> 選項二 </div>
<div> 選項三 </div>
<table>
<thead>
<tr>
<th>第一行</th>
<th>第二行</th>
<th>第三行</th>
</tr>
</thead>
<tbody id="myGrid">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>45</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</tbody>
</table>
以上不難看出此範例的用法
也就是當mouseOver(滑入時)是A方式的css,mouseOut(滑出時)是B方式的css
全站熱搜