Question

My web application uses the following popup-overlay plugin to show profile content in a popup on the screen:
http://vast-eng.github.io/jquery-popup-overlay/

My problem is related to a Google Map - marker infowindow that I use within the popup window.
When I try to close the infowindow, the popup disappears as well.
This is wrong! I don't immediately see why it is doing this.
If I don't find a solution, I could disable or hide the X, but I prefer not to do this.

The "where" section in the following link shows you the problem:
http://www.zwoop.be/dev/#list/bars/1

Edit The event parameter returns "undefined" for the following event listener:

google.maps.event.addListener(self.marker.infowindow, "closeclick", function(e)
    {
        console.log(e); 
    });

Thanks

enter image description here

Edit2 Here is a quick fiddle that illustrates the problem:
http://jsfiddle.net/462HF/

Was it helpful?

Solution

The blur function in the popup overlay plugin is getting called when you click the 'X' in the infoWindow on the google map, that is why the entire popup is closing. Below is the code in the jquery.popupoverlay.js file:

if (options.blur) {
            blurhandler = function (e) {
                if (!$(e.target).parents().andSelf().is('#' + el.id)) {
                    methods.hide(el);
                }
            };
        }

The 'X' is an image, and its parents()only go back to the InfoWindow div, but not the popup div. Therefore, it will call methods.hide(el) and close the popup.

There is probably a better way of determining if it was clicked, but changing it to the following works. It just checks the target's img source:

if (options.blur) {
            blurhandler = function (e) {
                if (!$(e.target).parents().andSelf().is('#' + el.id) ) {
                    if(!($(e.target).attr('src') === 'http://maps.gstatic.com/mapfiles/api-3/images/mapcnt3.png'))
                        methods.hide(el);
                }
            };
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top