When viewing Google maps in full screen mode, the image suddenly vanishes

I have a map with a logo positioned in the lower right corner near the controls. However, when I switch to full screen mode, the logo disappears. I can see the div (aggdata-info) in Firebug, but the image/logo is not visible. Any suggestions on how to fix this?

initMap : function() {
var me = this;

me.map.mapOptions = {
zoom : 4,
center : {
lat: 37.6,
lng: -95.665
},
mapTypeControlOptions : {
mapTypeIds : [
//'map_style',
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.TERRAIN,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.HYBRID
]
},
//mapTypeId : 'map_style',

zoomControl : true,
mapTypeControl : true,
scaleControl : false,
streetViewControl : true,
rotateControl : true,
fullscreenControl : true,
fullscreenControlOptions : {
position : google.maps.ControlPosition.RIGHT_BOTTOM
}

};
div.aggdata-info {
height: 38px;
width: 170px;
text-align: center;
    line-height: 28px;
background: #fff url(../cmnimages/reit_common/data_by_aggdata.png) center center no-repeat;
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
font-size: 12px;
position: absolute;
    margin-top: 493px;
    margin-left: 832px;
    padding: 0px 5px 0px 5px;
}

Logo displayed in standard size Logo disappears in full-screen mode

Below is the CSS code for the specified div.

Answer №1

Please follow my code and I apologize for not using your code! I made all the necessary changes in my own code.

Note: In the js file included, you will need to add your Google API key to avoid display errors on the Google map page:

Google Maps API error: InvalidKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key-map-error.

By using this disableDefaultUI: true, I have hidden certain objects on the Google map. It is also possible to hide specific objects on the map.

If you wish to make edits to your code, add the following code below:

var customControlDiv = document.createElement('div');
var customControl = new CustomControl(customControlDiv, map);
customControlDiv.index = 1;

And the function goes like this:

function CustomControl(controlDiv, map) {
            var tempBackgroundImage = "http://www.clker.com/cliparts/W/0/g/a/W/E/map-pin-red-md.png";
            controlDiv.style.padding = '5px';
            controlDiv.style.right = '5px';
            var myLocationControlDiv = document.createElement('DIV');

            var controlUI = document.createElement('DIV');
            controlUI.style.cursor = 'pointer';
            controlUI.style.background = "url(" + tempBackgroundImage + ") 68px 78px";
            controlUI.style.height = '68px';
            controlUI.style.width = '68px';
            controlUI.style.right = '15px';
            controlUI.style.bottom = '50px';
            controlUI.style.backgroundSize= '68px 78px';
            controlUI.title = 'Current location';

            myLocationControlDiv.appendChild(controlUI);
            map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlUI);

    }

That's all you need!

You can utilize the complete code below if you're not using any other code:

Html

 var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8,
          disableDefaultUI: true
        });
        var customControlDiv = document.createElement('div');
        var customControl = new CustomControl(customControlDiv, map);

        customControlDiv.index = 1;
      }
      function CustomControl(controlDiv, map) {
var tempBackgroundImage = "http://www.clker.com/cliparts/W/0/g/a/W/E/map-pin-red-md.png";
controlDiv.style.padding = '5px';
controlDiv.style.right = '5px';
var myLocationControlDiv = document.createElement('DIV');

var controlUI = document.createElement('DIV');
controlUI.style.cursor = 'pointer';
controlUI.style.background = "url(" + tempBackgroundImage + ") 68px 78px";
controlUI.style.height = '68px';
controlUI.style.width = '68px';
controlUI.style.right = '15px';
controlUI.style.bottom = '50px';
controlUI.style.backgroundSize= '68px 78px';
controlUI.title = 'Current location';

myLocationControlDiv.appendChild(controlUI);
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlUI);

}
 /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
<script src="https://maps.googleapis.com/maps/api/js?key={YOUR_API_KEY}&callback=initMap"
    async defer></script>
<div id="map"></div>

Important thing:

Please adjust the values below according to the image size.

controlUI.style.height = '68px';
controlUI.style.width = '68px';
controlUI.style.backgroundSize= '68px 78px';

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Missing ghost image appears when you drag and drop the file

New to JavaScript... As a rookie in coding, I often get interesting requests from my partner who is a kindergarten teacher. Recently, she asked me to create a "Function Machine" for her classroom activities. With some trial and error, I managed to put tog ...

Deactivate the BACKSPACE button

Similar Question: How to disable backspace except textbox using jQuery I am looking for a solution to prevent the BACKSPACE button from functioning unless it is within a TEXT field. Although I have tried the code below, it ends up disabling the backs ...

The visual symbol is not being shown on the selection box in Mozilla Firefox

I've encountered an issue with a checkbox I created to display a + and - for expand and collapse functionality. HTML Code: <input type=checkbox class="ins" ng-model=show ng-class='{open:show}'><b>Show</b> CSS code: .ins ...

Execute SQL Server stored procedure passing a collection of dates to disable on a jQuery datepicker

I am currently working on a Classic ASP system that includes a jquery datepicker. My goal is to automatically disable certain days by populating an array with these dates. Currently, the functionality only allows for manual disabling of dates using a funct ...

Enhance jQuery for a dynamic navigation dropdown with multiple sub-menus

Looking for help with a jQuery script as I am a beginner in using jQuery. jQuery(document).ready(function ($) { $(".sub-menu").hide(); $(".current_page_item .sub-menu").slideDown(200);; $("li.menu-item").click(function () { if ($('.sub-menu&apos ...

Guide for Sending a Textnode from One Page to a Different Page within a Specific Id Element through PHP

firstpage.html : <body> <?php $text = $_POST['text']; ?> <p style = "color:red; " id = "getext"><?php echo $text; ?></p> </body> secondpage.php : <body> <?php $text = $_POST['text']; ?> ...

Increase and decrease the size of a table row in real-time

I am attempting to create a bootstrap table in which clicking a button in the first column will expand the specific row to show more details. I am aiming for a result similar to what can be found at this link, but without using the DataTables framework. ...

What is the best way to turn off the jQuery Kladr plugin?

Currently, I'm incorporating the jquery kladr plugin to facilitate address autocompletion specifically for Russia. I am wondering how to deactivate this plugin should a different country be selected? ...

Generating hierarchical structures from div elements

Looking for guidance on how to parse a HTML page like the one below and create a hierarchical Javascript object or JSON. Any assistance would be much appreciated. <div class="t"> <div> <div class="c"> <input t ...

Perform an operation in JQuery after a different operation has been completed

Recently, I came across this JavaScript function that displays a loading image for a few seconds before revealing a hidden div: <script type="text/javascript> $(document).ready(function () { $('#load').html('<img style="display ...

Exploring nested JSON with jQuery

I have the following JSON data provided below. I am trying to access and retrieve the values for TOP1 and TOP2, but I am unsure of the correct method to do so. Currently, I am utilizing the following code snippet. However, it is returning an object with n ...

Welcome to the awe-inspiring universe of Typescript, where the harmonious combination of

I have a question that may seem basic, but I need some guidance. So I have this element in my HTML template: <a href=# data-bind="click: $parent.test">«</a> And in my Typescript file, I have the following code: public test() { alert( ...

What steps do I need to take to launch an embedded kml tour?

This marks the beginning of my journey into the world of online forums! I used to rely on Stack Exchange for answers to my questions, but most of the time, someone else had already asked what I needed to know. It goes to show how effective this website is. ...

Whenever I try to include something within the `componentWillUnmount` function,

I'm currently learning React on my own. I've been trying to save session data in my componentWillUnmount method. However, when I add code inside componentWillUnmount, nothing seems to happen. I tried debugging by adding console logs and debugger ...

How to capture text outside of a HTML tag using Selenium with Python?

I need help extracting the specific text inside a div element that is not enclosed by a label. <div style="color:red;"> <label> Total Amount Due:</label> $0.00 </div> Only interested in retrieving the $0.00 amount from th ...

Ensuring Consistent Item Widths in a Loop using JavaScript or jQuery

In my code, I created a function that dynamically adjusts the width of elements in a loop to match the widest element among them. // Function: Match width var _so20170704_match_width = function( item ) { var max_item_width = 0; item.each(function ...

The element's position remains unchanged after the .click re-event in the function

Welcome to my first attempt at using jQuery! Please bear with me as I navigate through this learning process. Here's the challenge: I have a series of elements in my HTML. <div class="garden"> <div class="point left">&#9668;</d ...

What obstacles must be overcome when developing a CSS framework?

Currently, I am delving into the realm of popular CSS frameworks such as Bootstrap and Foundation. While studying them, I have identified aspects that I believe could be enhanced and customized to suit my own projects or potentially for free distribution i ...

The div element moves to the right as soon as the drop-down menu pops up

Currently, I am facing an issue with aligning an image inside a div that is centered in an outer-wrapper. The outer-wrapper contains a horizontal menu at the top with 5 sub divs displayed inline. I have implemented CSS for a drop-down menu that appears whe ...

Tips on incorporating the $ symbol into a pseudo element

Can I add a price using a pseudo element? h3:after{ content: " (+ $75)"; } <h3>price</h3> The CSS minifier is preventing the display of "$75". How can I work around this issue? ...