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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:05:33+00:00 2026-06-17T14:05:33+00:00

I have a screen where two things are displayed. A Google street map is

  • 0

I have a screen where two things are displayed.

  1. A Google street map is rendered using Openlayers.
  2. A side panel is rendered to display a list of countries and their annual population growth.

Below code explains the idea. Code is written in HTML.

<body>
 <div id="map" style="z-index:0;"></div>
 <div id="sidePanel" style="position:absolute;
                            top:0px;
                            left:0px;
                            width:30%;
                            height:100%;
                            z-index:1;
                            background-color:black">
 //content in this div will be filled dynamically through ajax call
 </div>
</body>

Everything displayed perfectly. But, when I click on #sidepanel and holding mouse click, if I drag, then #map is receiving the mouse click and ‘Pan Operation’ is occuring on screen.

I dont want ‘#map’ to receive mouseclick when clicked on #sidepanel. Also, when I position mouse over #sidepanel and double click on that div, #map is receiving the double click and Zoom Operation is happening . I want to separate #map and #sidepanel.

I am experiencing this problem only with Firefox and Chrome browsers. IE is working fine for my requirement.
Please suggest some ideas. Thanks for your patience.

HERE IS MY COMPLETE CODE

<html>
<head>
<title>Map</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&v=3.6"></script>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body onload="RenderGoogleMap();">
<div id="Map_Screen" style="z-index: -1;"></div>
<div id="sidePanel" style="overflow:hidden;position:absolute;top:0px;left:0px;width:35%;height:100%;background-color:black;"></div>
</body>
</html>
<script type="text/javascript">
function RenderGoogleMap() {
        var options = {
            projection : "EPSG:900913",
            units : "m",
            maxResolution : 156543.0339,
            maxExtent : new OpenLayers.Bounds(-20037508.34, -20037508.34,20037508.34, 20037508.34),
            displayProjection : new OpenLayers.Projection("EPSG:4326")
        };
        map = new OpenLayers.Map('Map_Screen', options);
        var gmap = new OpenLayers.Layer.Google("GoogleMap", { 'sphericalMercator' : true, numZoomLevels : 18 });
        map.addLayers([ gmap ]);
            map.zoomTo(3);
        var control = map.addControl( new OpenLayers.Control.Navigation() );
        control.activate();
    }
</script>
  • 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-17T14:05:35+00:00Added an answer on June 17, 2026 at 2:05 pm

    Could it be because you’ve set the position of the sidePanel as absolute, and as a result the sidepanel div is on top of the map? Try removing the position:absolute from your sidePanel CSS code.

    Update:

    The problem was that the width of your map was set to 100%, and your sidepanel was overlayed on top of it. Instead of doing this, I kept your sidepanel at 35% width, added a 2% right margin, and set the map to be 62%. This way, you have the sidepanel and map not overlapping, so when you click on the sidepanel the map will not be affected in any way.

    See the code:

    <html>
    <head>
    <title>India</title>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&v=3.6"></script>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
    function RenderGoogleMap() {
            var options = {
                projection : "EPSG:900913",
                units : "m",
                maxResolution : 156543.0339,
                maxExtent : new OpenLayers.Bounds(-20037508.34, -20037508.34,20037508.34, 20037508.34),
                displayProjection : new OpenLayers.Projection("EPSG:4326")
            };
            map = new OpenLayers.Map('Map_Screen', options);
            var gmap = new OpenLayers.Layer.Google("GoogleMap", { 'sphericalMercator' : true, numZoomLevels : 18 });
            map.addLayers([ gmap ]);
            var control = map.addControl( new OpenLayers.Control.Navigation() );
            control.activate();
        }
    </script>
    </head>
    <body onload="RenderGoogleMap();">
    <div id="sidePanel" style="float:left;width:35%;margin-right:2%;height:100%;background-color:black;"></div>
    <div id="Map_Screen" style="float:left;width:62%;"></div>
    </body>
    </html>
    

    Update 2:

    If you want the overlay but dont want the side panel to manipulate the map, try this code. It sets the map z-index to -1 and the overlay z-index to 999.

    <html>
    <head>
    <title>Map</title>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&v=3.6"></script>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    </head>
    <body onload="RenderGoogleMap();">
    <div id="Map_Screen" style="z-index: -1;"></div>
    <div id="sidePanel" style="z-index:999;overflow:hidden;position:absolute;top:0px;left:0px;width:35%;height:100%;background-color:black;"></div>
    </body>
    </html>
    <script type="text/javascript">
    function RenderGoogleMap() {
            var options = {
                projection : "EPSG:900913",
                units : "m",
                maxResolution : 156543.0339,
                maxExtent : new OpenLayers.Bounds(-20037508.34, -20037508.34,20037508.34, 20037508.34),
                displayProjection : new OpenLayers.Projection("EPSG:4326")
            };
            map = new OpenLayers.Map('Map_Screen', options);
            var gmap = new OpenLayers.Layer.Google("GoogleMap", { 'sphericalMercator' : true, numZoomLevels : 18 });
            map.addLayers([ gmap ]);
                map.zoomTo(3);
            var control = map.addControl( new OpenLayers.Control.Navigation() );
            control.activate();
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have selected two components in the Customize Layout screen using a hint from
I have a screen with two RadioButtonField objects. By default, the first RadioButtonField shows
i have a screen contains just two components 1-textView 2-button the textView starts from
Suppose I have two fingers touching iPhone's screen but just one is moving. TouchesMoved
I have Two Tabs Tab-1 and Tab-2 at bottom of the screen. Send button
I have two views, one view takes the whole screen, the second view covers
I want to have two Emacs windows on the screen: one for Dired and
How can you combine two windows in Screen? I have two windows such that
I'm trying to draw two sprites on the same screen. I have defined the
i am self_learner to android. I have two screens.The first screen contains one edittext

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.