From: Matthias Schmidt Date: Thu, 20 Mar 2014 16:26:23 +0000 (+0100) Subject: Fixes rendering of Google Maps in mobile sidebars X-Git-Tag: 2.0.5~26^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=17994b04aeb3fc1fb84bab467b39cea0adf89a8c;p=GitHub%2FWoltLab%2FWCF.git Fixes rendering of Google Maps in mobile sidebars --- 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. *