Google maps hide/display issue -
i using ionic framework (though not sure that's relevant) , have view user can toggle between map , list mode. issue if initial mode list, , user toggles, map cropped/messed up. if initial mode map itself, well. have codepen - http://codepen.io/anon/pen/oprvrg - illustrate issue experiencing. it's set map mode right now, can change line
$scope.viewmode = 'map';
to
$scope.viewmode = 'list';
to see problem. ideas why happening or how fix/get around it?
changed changeviewmethod
function changeviewmode (){ if (viewmode == 'map'){ document.getelementbyid('map-canvas').style.display = 'none'; document.getelementbyid('list-canvas').style.display = 'block'; viewmode = 'list'; } else { document.getelementbyid('map-canvas').style.display = 'block'; document.getelementbyid('list-canvas').style.display = 'none'; viewmode = 'map'; google.maps.event.trigger(map, 'resize'); map.panto(new google.maps.latlng(-34.397, 150.644)); } }
and solved issue in second (pure maps) codepen.
Comments
Post a Comment