Reputation: 91
I am having the strangest problem. I cant figure out why the google map on a site i'm building slowly freezes the page after about 5 or 6 post backs. I'm currently using a calendar in an update panel, and the back and next buttons cause the google map to do strange things. I've removed the update panel, and it still does the same thing. After about 3 clicks the marker icon starts to slowy fuzz out and eventually turns black. Its making me nuts. Any thoughts would be really helpful. THanks. A link to a page with the problem is http://adkrenter.com/properties/106-plum-poppy-north and it does it in both ie and firefox.
Upvotes: 1
Views: 404
Reputation: 20371
Your underlying problem is that on each click to Prev
or Next
, you're adding 3 times the previous number of markers to the map at the same location.
I can't tell you why this is happening (or how to fix it) without seeing more code (it's painful wading through the page source so if you could post some relevant code for what you're doing on click, that might help)
Update
I looked at the response after about 7-10 clicks and it's a huge (relatively speaking, the initial response is only a few 10s of KB) 168 KB of which 143 KB is JavaScript code to add the same marker to the two maps on the page - 162 times each! It's no wonder the page freezes.
This is part of the response:
var GoogleMap1 = new Artem.Web.GoogleMap({"Address":"106 Plum Poppy North, Malta , NY, 12020","BaseCountryCode":null,"ClientID":"ctl05_GoogleMap1","ClientMapID":"GoogleMap1","DefaultAddress":null,"DefaultMapView":0,"Directions":[],"EnableContinuousZoom":false,"EnableDoubleClickZoom":false,"EnableDragging":true,"EnableGoogleBar":false,"EnableInfoWindow":true,"EnableMarkerManager":false,"EnableReverseGeocoding":false,"EnableScrollWheelZoom":false,"EnterpriseKey":null,"Height":"130px","IsStreetView":false,"IsStatic":false,"Key":"ABQIAAAATFt6mjpmHxeLQ689NDV5WhTHwM4h-1LWnzPqjMrWYJQMyFF86hTACw-YJNmRQV0Dk4jcB3zQHvdUsw","Latitude":42.968839,"Longitude":-73.777681,"MapEvents":{},"MarkerEvents":{},"MarkerManagerOptions":{"borderPadding":null,"maxZoom":null,"trackMarkers":null},"PolygonEvents":{},"PolylineEvents":{},"ShowMapTypeControl":false,"ShowScaleControl":false,"ShowTraffic":false,"StreetViewMode":0,"StreetViewPanoID":null,"Width":"190px","Zoom":14,"ZoomPanType":0});
GoogleMap1.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
GoogleMap1.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
GoogleMap1.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
//repeated a few hundred times
GoogleMap2.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
GoogleMap2.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
GoogleMap2.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
GoogleMap2.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
GoogleMap2.addMarker({"Address":"106 Plum Poppy North, Malta , NY, 12020","AutoPan":true,"Bouncy":false,"Clickable":true,"Draggable":false,"DragCrossMove":false,"IconAnchor":{"X":0,"Y":0},"IconSize":{"Height":0,"Width":0},"IconUrl":null,"InfoWindowAnchor":{"X":0,"Y":0},"Latitude":42.968839,"Longitude":-73.777681,"MaxZoom":null,"MinZoom":null,"OpenInfoBehaviour":0,"ShadowSize":{"Height":0,"Width":0},"ShadowUrl":null,"Text":null,"Title":null});
//repeated a few hundred times
GoogleMap2.load();
I'm not familiar with .NET and C# so I can't really help much beyond this since I don't know how this 'update panel' works. But it seems like the problem lies with the server - it's sending back the same marker with a count that seems to be growing geometrically - the incoming number of markers is 3 times the previous number of markers.
Upvotes: 2