0
我正在写一本交互式书籍,并希望通过使用CSS目标伪选择器来触发事件。不过,我想让链接多次点击。目前,如果我有两个链接,一个是Parrot,一个是Leopard,我可以交替动作,点击一个链接,然后点击另一个链接来触发事件。我需要的是能够连续点击两次,三次等。CSS target click multiple
这是HTML标记
<span id="line1"><a href="#parrot">Litte Parrot</a></span>
<span id="line2"><a href="#leopard">Leopard</a></span>
这是CSS
.parrot:target { -webkit-animation: do_something 1s;}
.leopard:target { -webkit-animation: do_something_else 1s;}
Thnk你
编辑
已与更换的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;}
的JavaScript
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他在'' – 2012-07-19 16:56:05
中归类[我不确定我知道你的意思是...] – glebski 2012-07-20 10:22:14