대화 형 서적을 쓰고 있으며 CSS 대상 의사 선택기를 사용하여 이벤트를 발생시키고 싶습니다. 그러나 링크를 여러 번 클릭하도록 허용하고 싶습니다. 내가 앵무새와 표범에게 두 개의 링크가있는 순간, 한 링크를 클릭 한 다음 다른 링크를 클릭하여 이벤트를 실행시킬 수 있습니다. 내가 필요한 것은 앵무새를 두 번, 세 번 등을 연속으로 클릭 할 수 있어야한다는 것입니다. CSS 타겟 클릭 복수
이
이는 CSS.parrot:target { -webkit-animation: do_something 1s;}
.leopard:target { -webkit-animation: do_something_else 1s;}
이 Thnk에게 있습니다
<span id="line1"><a href="#parrot">Litte Parrot</a></span>
<span id="line2"><a href="#leopard">Leopard</a></span>
HTML 태그 당신
이 div의 교체와 함께 장난 적이 편집, 그래서 대상 개체 변경 사항 및 링크 그것을 해고하라고. 그것은 작동하지만 아주 엉망 솔루션과 같습니다. 이 인스턴스의 링크 및 타겟은 동일한 객체 (앵무새의 이미지)입니다. 누구든지 더 나은 해결책을 제안 할 수 있습니까?
HTML 마크 업
<!-- touch activated animation -->
<a href="#parrot2"><div id="parrot1" class="parrot" onclick="replace1()">
<div class="left_eye"></div>
<div class="right_eye"></div>
</div></a>
<!-- /touch activated animation -->
<!-- touch activated animation -->
<a href="#parrot1"><div id="parrot2" class="parrot" style="display: none" onclick="replace2()">
<div class="left_eye"></div>
<div class="right_eye"></div>
</div></a>
<!-- /touch activated animation -->
CSS
.parrot:target { -webkit-animation: do_something 1s;}
자바 스크립트
즉 내가 예를 가지고있는 경우입니다 경우 단지 두 개의 서로 다른 앵무새 간을 전환하는 것 같습니다function replace1() {
document.getElementById("parrot1").style.display="none";
document.getElementById("parrot2").style.display="block";
}
function replace2() {
document.getElementById("parrot2").style.display="none";
document.getElementById("parrot1").style.display="block";
}
하지만 .. t 그는 클래스를 ''에 입력했습니다. –
당신이 무엇을 의미하는지 잘 모르겠습니다 ... – glebski