jQueryを少し使い始めました。jQuery:a hover underline?
サムネイルの表があり、その中の画像にマウスカーソルを合わせると各セルがハイライト表示されます。その部分は働いている。しかし、私はまた、セル内の画像にアンダーラインがないようにしたい - これはスタイルシートa:hover{text-decoration:underline}
から継承されています。これは私が立ち往生している場所です、私は正しいことを設定しているとは思わない。私のjQueryのように見えるので、私は、インラインスタイルを使用する必要が
:
$('[name*=thumb]').hover(
function() {
//as we hover over an item, change it's background, attempt to vaquish pesky underline
$('#' + $(this).attr('id').replace('thumb', 'thumbcontainer')).css('background-color', '#cccccc');
$('#' + this).css('text-decoration', 'none'); //doesn't work : (
},
function() {
//fix bgs of items we're not hovering on
$('#' + $(this).attr('id').replace('thumb', 'thumbcontainer')).css('background-color', '#ffffff');
}
);
は私のHTMLは次のようになります。
<td name="thumbcontainer8" id="thumbcontainer8"><a href="#" name="thumb8" id="thumb8"><img src="..." /></a></td>
<td name="thumbcontainer9" id="thumbcontainer9"><a href="#" name="thumb9" id="thumb9"><img src="..." /></a></td>
。 –
これはCSSのためのものです。 jqueryを使用してCSSタグを追加/削除する –