Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8275025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:56:09+00:00 2026-06-08T07:56:09+00:00

I am writing an interactive book and would like events to be fired by

  • 0

I am writing an interactive book and would like events to be fired by using the CSS target Pseudo-selector. However I would like to allow the link to be clicked multiple times. At the moment if I have two links, one to Parrot and one to Leopard, I can alternate the action, clicking on one link, then another to fire the events. What I need is to be able to click on Parrot twice, three times etc. in a row.

This is the HTML markup

<span id="line1"><a href="#parrot">Litte Parrot</a></span>
<span id="line2"><a href="#leopard">Leopard</a></span>

This is the CSS

.parrot:target { -webkit-animation: do_something 1s;}
.leopard:target { -webkit-animation: do_something_else 1s;}

Thnk you

EDIT

Have been messing around with replacing divs, so the target object changes as well as the link to fire it. Seems like a very messy solution although it does work. The link and target in this instance are the same object (an image of a parrot). Can anyone suggest a better solution?

HTML Markup

<!-- 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";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:56:10+00:00Added an answer on June 8, 2026 at 7:56 am

    It looks like you are just toggling between two different parrots, if that is the case I have an Example. If you want it to be more then 2 parrots see Example 2.

    Example 1 here: http://jsfiddle.net/yW6T3/1/

    Example 1 Explanation (with comments):

    $(document).ready(function() {//when the document is loaded/ready
        $("#parrotlink").click(function() {//on parrotlink click
            $("#parrot1").toggle();//toggle parrot1 on if off, off if on
            $("#parrot2").toggle();//toggle parrot2 on if off, off if on
        });
    });​
    

    Example 2 here: http://jsfiddle.net/yW6T3/2/

    Example 2 Explanation (with comments):

    $(document).ready(function() {//when the document is loaded/ready
        $("#parrotlink").click(function() {//On parrotlink clicked do function
              if($(".parrot.active").next(".parrot").length==0)//if there is nothing for a next element/parrot
              {
              $(".parrot.active").removeClass("active");//remove active class from active
              $(".parrot:first-child").addClass("active");//make first parrot active
              }
              else//if there is a next element/parrot in line
              {
              $(".parrot.active").removeClass("active").next(".parrot").addClass("active");//remove active class from active and make next parrot active
              }
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing my first Cocoa app and I would like to make a trackball
I'm writing an interactive function that I'd like to have remember the last argument
What is the best programming language for writing MIDI-interactive musical application that would be
I am writing something like an interactive tutorial for C++. The tutorial will consist
Writing a client / server program and previously was using calls like this: TcpListener.AcceptTcpClient()
I'm writing my first interactive animation in Flash CS3 and I'm having trouble locating
Writing a python program, and I came up with this error while using the
I'm writing an interactive fiction game in java from scratch. I'm currently storing all
I am writing a web application which will include several parts - interactive calendar,
I am writing a desktop application and trying to decide between using AIR (FLex)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.