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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:49:31+00:00 2026-05-26T09:49:31+00:00

What would be the most rational, cross-browser compatible way to create an element which

  • 0

What would be the most rational, cross-browser compatible way to create an element which has a shape of a circle? This element will be invisible, but clickable = it will be over a background which already has the image on it, so I just need to create an invisible, imaginary element to make the background circle clickable.

The element doesn’t need to be <a> tag, as the click events will be bound using jquery only and don’t need to send any href to the browser. Therefore a div will do. The question is: how to accomplish the rest?

EDIT

Actually, I need to change the url with each click, but not to refresh the page, but to have the url available for users to copy. Therefore if I can bind the div tag with jquery to change the url from base#home to base#contact, then all is OK.

EDIT2

I don’t need the jquery code, I just need the html/css part to create the elements.

  • 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-26T09:49:31+00:00Added an answer on May 26, 2026 at 9:49 am

    Ok I might be barking up the wrong tree here…

    To find clicks inside a circle, you could use the mouse postion, and then find the distance from your circle’s origin.

    jQuery very helpfully provides position() which returns an object with two variables which show the x and y position, if you know how big your picture is then you can work out if the mouse click in inside the circle using Pythagoras’ theorem.

    Something like:

    $(document).mousedown(function(e) {
    
       //img_element is your image...
       var img_pos = $("#img_element").position();
    
       //these are the coordinates for the center of the circle
       var centerX = img_pos.top + (img_width/2);
       var centerY = img_pos.left + (img_height/2);
    
       //this is the radius of your circle
       var radius = 100;
    
       if(Math.sqrt(Math.pow(e.clientX-centerX, 2) + Math.pow(e.clientY-centerY, 2)) < radius) {
           //here we do the things when the click is inside the circle
           console.log("yes");
       }
    
    });
    

    Hope this helps you…

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

Sidebar

Related Questions

What would be the most efficient way of recording to a log (.txt) from
What would be the most effective way to grab the schema + table name
What would be the most idiomatic way to do the following in JavaScript: If
What would be the most elegant way to implement a Win32 equivalent of WaitForMultipleObjects
What would be the most efficient way of counting the number of times a
Consider compounds of two nouns, which in natural English would most often appear in
We've got a multi-agent Java environment where different agent would most likely produce all
What would be the most optimal algorithm (performance-wise) to calculate the number of divisors
What would be the most efficient data type to store a UUID/GUID in databases
What would be the most efficient method of reading a text file into a

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.