From 17994b04aeb3fc1fb84bab467b39cea0adf89a8c Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 20 Mar 2014 17:26:23 +0100 Subject: [PATCH] Fixes rendering of Google Maps in mobile sidebars --- wcfsetup/install/files/js/WCF.Location.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.Location.js b/wcfsetup/install/files/js/WCF.Location.js index 379669f8c0..19c4713050 100644 --- a/wcfsetup/install/files/js/WCF.Location.js +++ b/wcfsetup/install/files/js/WCF.Location.js @@ -117,9 +117,25 @@ WCF.Location.GoogleMaps.Map = Class.extend({ this._map = new google.maps.Map(this._mapContainer[0], this._mapOptions); this._markers = [ ]; + // fix maps in mobile sidebars by refreshing the map when displaying + // the map + if (this._mapContainer.parents('.sidebar').length) { + enquire.register('screen and (max-width: 800px)', { + setup: $.proxy(this._addSidebarMapListener, this), + deferSetup: true + }); + } + this.refresh(); }, + /** + * Adds click listener to mobile sidebar toggle button to refresh map. + */ + _addSidebarMapListener: function() { + $('.content > .mobileSidebarToggleButton').click($.proxy(this.refresh, this)); + }, + /** * Returns the default map options. * -- 2.20.1