기본적으로 div 내에서 스프라이트 섹션을 표시하고 다른 링크를 클릭하면 표시되는 스프라이트 섹션이 변경되는 div 아래에 텍스트 메뉴가 표시됩니다. 지금까지이고 다음과 같이 표시 내 스프라이트을 모두 찍었을 경우 여기링크를 통한 스프라이트 이미지 대체
은 다음과 같습니다
INDEX
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<i class="sprite sprite-caramel"></i>
<i class="sprite sprite-chocolate"></i>
<i class="sprite sprite-empty"></i>
<i class="sprite sprite-strawberry"></i>
<i class="sprite sprite-vanilla"></i>
</body>
</html>
CSS
.sprite {
background-image: url(sprite1.png);
background-repeat: no-repeat;
display: block;
}
.sprite-caramel {
width: 176px;
height: 250px;
background-position: 0 0;
}
.sprite-chocolate {
width: 176px;
height: 250px;
background-position: -176px 0;
}
.sprite-empty {
width: 176px;
height: 250px;
background-position: -352px 0;
}
.sprite-strawberry {
width: 176px;
height: 250px;
background-position: -528px 0;
}
.sprite-vanilla {
width: 176px;
height: 250px;
background-position: -704px 0;
}
내가 것 같은 일을하고 싶다면 기본적으로 div 안에 "empty"를 표시하고 div 아래에 텍스트 링크가 있습니다. s를 "초콜릿" "바닐라" "딸기"등으로 바꿉니다. 링크를 클릭하면 스프라이트 위치가 클릭되어 링크 이미지가 반영됩니다.
나는 단지 내가 스프라이트 100 % 새로운 오전과 지금까지 그들을 사용한 적이
... 구글로 검색 할 때 호버에서 이미지 교체를 찾을 수있을 것 같다.
스프라이트 이미지는 다음에서 찾을 수 있습니다. http://puu.sh/3orSM.png – Meta
호버에 이미지 세트가 있습니까? –
확실히 당신은 클릭 한 컨트롤에 반응하여 배경이 이동되는 단지 하나의'sprite' 엘리먼트를 원하십니까? 그대로, 모든 컨트롤에는 클래스 "스프라이트"가 있으며 클릭 한 컨트롤에 응답 할 요소가 없습니다. 이것은 틀린 것 같습니다. –