Skip to content

Instantly share code, notes, and snippets.

@DylanCodeCabin
Created October 20, 2025 06:24
Show Gist options
  • Select an option

  • Save DylanCodeCabin/83ccaee2daa5ff02c88ad909178d148f to your computer and use it in GitHub Desktop.

Select an option

Save DylanCodeCabin/83ccaee2daa5ff02c88ad909178d148f to your computer and use it in GitHub Desktop.
jQuery(($) => {
if(WPGMZA.isProVersion())
Parent = WPGMZA.ProInfoWindow;
else
Parent = WPGMZA.InfoWindow;
WPGMZA.OLInfoWindow.prototype.open = function(map, feature)
{
var self = this;
var latLng = feature.getPosition();
if(!latLng){
return false;
}
if(!Parent.prototype.open.call(this, map, feature)){
return false;
}
// Set parent for events to bubble up
this.parent = map;
if(this.overlay)
this.feature.map.olMap.removeOverlay(this.overlay);
this.overlay = new ol.Overlay({
element: this.element,
stopEvent: true,
insertFirst: false
});
this.overlay.setPosition(ol.proj.fromLonLat([
latLng.lng,
latLng.lat
]));
self.feature.map.olMap.addOverlay(this.overlay);
$(this.element).show();
this.setContent(this.content);
if(WPGMZA.OLMarker.renderMode == WPGMZA.OLMarker.RENDER_MODE_VECTOR_LAYER)
{
WPGMZA.getImageDimensions(feature.getIcon(), function(size) {
$(self.element).css({left: Math.round(size.width / 2) + "px"});
});
}
/* Apply scroll fix for OpenLayers */
this.autoResize();
this.trigger("infowindowopen");
this.trigger("domready");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment