0

問題の解決策を見つけるために約 1 時間検索しましたが、あまり助けが見つかりません。

背景画像として設定されたスプライト画像を含む div があるため、1 つの画像が 1 つの jpg で他の画像の上に配置されます。また、div にカーソルを合わせると、スプライト イメージの位置が変更され、別の状態が表示されます。

イメージ マッピングを使用して、背景イメージの 1 つのセクションをクリックすると、スプライトの背景イメージの位置が変更され、別の状態が表示されるようにしたいと考えています。もう一度クリックすると、元の状態に戻ります。

これが理にかなっていることを願っています。お時間をいただきありがとうございます。

.imageswap {
    list-style: none;
    height: 495px;
    width: 940px;
    display: block;    
    background: url('/HTMLContent/images/frozenpeas_web_sprite3.jpg') 0 0;
}

.imageswap:hover{
    background-position: 0 -495px;
}
<div class="ContentBorders imageswap" style="margin:0 auto;">
    <div class="textandlogo" style="width: 249px; height: 145px; padding: 0; z-index: 99; float: left;">
        <img src="/HTMLContent/images/frozenpeas_logo.png" height="94" width="344" />
        <p class="sucktextblack" style="text-align: left; padding: 0 0 0 17px; margin: 0; width: 255px;">
            <strong>Make Ice Balls</strong><br />
            Ice cubes and a  refreshing drink go together like peas in a pod, which is why we bring you the  frozen peas ice cube mould! Frozen ice peas home-grown from your own freezer  and completely reusable. Perfect for hap-pea occasions or just for vegging out  in front of the TV. Easy peasy<br />
            <span class="sucksmall" style="text-align: left;" >Design by Alessandro Martorelli</span>
        </p>
    </div>

    <div style="width: 202px; height: 202x; padding:0; margin: 270px 20px 0 0; z-index: 98; float: right;">
        <img src="/HTMLContent/images/frozenpeas_circle.png" height="202" width="202" />
4

2 に答える 2