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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:23:32+00:00 2026-06-14T15:23:32+00:00

I want to display a certain Infobox when the user clicks anywhere on the

  • 0

I want to display a certain Infobox when the user clicks anywhere on the map and a different Infobox when the user clicks inside an OverlayView.

I’m adding a listener to the click event for the map object, but this event only provides a latLong param which seems insufficient to tell if an OverlayView was hitted.

    google.maps.event.addDomListener(map, 'click', function(param) {
        // if( an OverlayView was clicked)
        // showInfoboxForOverlayView();
        // else
        // showStandarInfobox();
    });

I know I can add a separate listener for the OverlayView object, but when I do this, both events are fired (the one coming from the OverlayView object and the one from the map object).

This is how I construct my OverlayView object,

    var overlay = new google.maps.OverlayView();
    overlay.onAdd = function () {

        var layer = d3.select(this.getPanes().overlayMouseTarget).append("div").attr("class", "SvgOverlay");
        var svg = layer.append("svg");
        var adminDivisions = svg.append("g").attr("class", "AdminDivisions");

        overlay.draw = function () {
            var markerOverlay = this;
            var overlayProjection = markerOverlay.getProjection();

            // Turn the overlay projection into a d3 projection
            var googleMapProjection = function (coordinates) {
                var googleCoordinates = new google.maps.LatLng(coordinates[1] + 0.0005, coordinates[0] - 0.0006);
                var pixelCoordinates = overlayProjection.fromLatLngToDivPixel(googleCoordinates);
                return [pixelCoordinates.x + 4000, pixelCoordinates.y + 4000];
            }

            path = d3.geo.path().projection(googleMapProjection);
            adminDivisions.selectAll("path")
                    .data(geoJson.features)
                    .attr("d", path) // update existing paths
                    .enter().append("svg:path")
                    .attr("d", path);;
        };
    };

Any ideas?

  • 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-14T15:23:33+00:00Added an answer on June 14, 2026 at 3:23 pm

    Try using the cancelBubble flag from the global event object within the handler of the overlay element:

    event.cancelBubble = true;
    

    That should prevent the second click handler from triggering.

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

Sidebar

Related Questions

I want to display a dialog when a user mouses over a certain image.
I want my application to be able to display certain information when no user
I want to display a certain YouTube channel's videos and allow the user to
I'm using this code to display an alert on a certain element: $(#resultsBox).click(function (event)
in my app when user swipes a certain row I want to display a
Want to display a different message if the time is under a certain amount.
In My HTML Page I want to display certain Number of Buttons Based on
I want to display a div if a certain radio button in a form
I want to display visual/auditory stimuli inside a web browser for psychophysic experiments. I
I want to display a certain message on a certain page. Suppose the name

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.