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 8655083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:56:35+00:00 2026-06-12T14:56:35+00:00

There is a gallery which reads the data from a database. Below of that

  • 0

There is a gallery which reads the data from a database.

Below of that there are some circles which shows the number of all data or records.

Each time a circle turns to yellow which indicates that what is the active post.

I have generate this mechanism by this way :

function drawCircles(activeIndex) {
    var off_html = '<img class="post_circle" src="../themes/dark/images/off.png"/>';
    var on_html = '<img class="post_circle" src="../themes/dark/images/on.png"  />';
    $('#circles').empty();

    for (var i = 1; i <= pcount; i++) {

        if (i != activeIndex) {
            $(off_html).appendTo($('#circles'));
        }
        else {
            $(on_html).appendTo($('#circles'));
        }

    }


}

PCount = Count of All Posts…

#circles div is a bar which circles are in it.**

when we call

drawCircles(2)

The second circle turns to yellow.
Now I want to make a click event for that.I want to understand which circle has been clicked?
I have tried .live function , but I can’t found that which circle has been clicked…

  • 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-12T14:56:37+00:00Added an answer on June 12, 2026 at 2:56 pm

    Try:

    $('#circles img.post_circle').on('click', function(e) {
      // e.target is the circle clicked
    });
    

    Edit: Here is a fuller answer:

    $(function(){
      var off_html = '<img class="post_circle" src="http://placehold.it/50x50/ff0000"/>';
      var on_html = '<img class="post_circle" src="http://placehold.it/50x50/ffff00"/>';
    
      var pcount = 5;
    
      $('#circles').empty();    
      drawCircles(3);
    
      function drawCircles(activeIndex) {
        for (var i = 1; i <= pcount; i++) {
          if (i != activeIndex) {
            $(off_html).data('index', i).appendTo($('#circles'));
          } else {
            $(on_html).data('index', i).appendTo($('#circles'));
          }
        }
      }
    
      $('#circles img.post_circle').on('click', function(e) {
        alert($(this).data('index'));
      });
    });
    

    Here’s a fiddle

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

Sidebar

Related Questions

I have a application which handles picture chosen from gallery. But there is a
Im building a image gallery which reads file from disk, create thumbnails on the
i've a node type Gallery and a menu title Gallery which shows all the
Is there any jQuery gallery, which support multipages? My problem is, that every page
I have created a class which extends Gallery. There is no onCreate() method in
I'm fighting with writing a little gallery. There a some thumbs shown next to
I have custom gallery. Gallery represents items that are frame layout. There are one
Ive created a portfolio website for myself, there is a gallery which users can
I am working on a database design for a basic photo gallery which each
I want to make a simple photo gallery function. However, there are some strange

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.