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

  • SEARCH
  • Home
  • 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 6318293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:37:22+00:00 2026-05-24T15:37:22+00:00

The Challenge: Assign a click event to something which will draw a tally mark

  • 0

The Challenge:
Assign a click event to something which will draw a tally mark inside a container. The tally mark should respect other tally marks already drawn so the positioning of the tally marks makes sense. After every click, tally marks should represent total number of clicks thus far.

These are tally marks:

1       2          3              4                 5
▼       ▼          ▼              ▼                 ▼

Tally marks example

The following example has a tally mark count of 83:
enter image description here

Challenge Rules:

  • Must use JQuery & HTML 5.
  • Tally marks must be added to a container, not the body.
  • The container where you draw the tallies must grow to accommodate new tallies.
  • Sprite or CSS3 for the actual tick mark is up to you. Feel free to use the first image as your sprite 🙂
  • Increment ONLY – no need to remove tallies. Once they are scratched into a prison cell wall, they are there for life!
  • Must post a link to a working demo on http://jsfiddle.net/
  • Have fun!
  • 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-05-24T15:37:23+00:00Added an answer on May 24, 2026 at 3:37 pm

    Working demo

    $.fn.tallier = function () {
        var $this = this,
            bgUrl = 'https://i.stack.imgur.com/96hvp.png',
            bgHeight = 125,
            bgVals = [
                [45, 25], // width, background-position X
                [65, -35],
                [85, -115],
                [105, -215],
                [140, -360]
            ],
            count = 0;
    
        $this.click(function(e) {
            count++;
    
            // add new tally box every 5th
            if (count%5 == 1) {
                var $newTally = $('<div>').addClass('tally');
                $newTally.css({
                              background: 'url("' + bgUrl + '") ' +
                                bgVals[0][1] + 'px 0 no-repeat transparent',
                              float: 'left',
                              width: bgVals[0][0] + 'px',
                              height: bgHeight + 'px'
                          });
                $this.append($newTally);
            }
    
            // change background position and width for new tally
            var $lastTally = $this.find('.tally:last'),
                i = count%5 - 1;
            i = i < 0 ? 4 : i;
            $lastTally.css({
                'background-position': bgVals[i][1] + 'px 0',
                width: bgVals[i][0] + 'px'
            });
        });
    };
    
    // invoke
    $('#tally').tallier();
    $('#tally').click();
    

    Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the challenge: I have a Flash movie which will be embedded in a
I challenge you :) I have a process that someone already implemented. I will
The challenge The shortest code by character count, that will output musical notation based
The challenge The shortest code by character count that will generate a beehive from
The challenge The shortest code by character count that will output the numeric equivalent
Faced with the challenge of a new application with which you had free reign
The challenge: The shortest code by character count that will generate a series of
The challenge The shortest code by character count to draw an ASCII representation of
The challenge The shortest code by character count to identify and mark water depressions
The challenge The shortest code by character count, that will output playing bricks tower

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.