admin管理员组文章数量:1426087
Is there any way to intercept the default behaviour of the full screen control using the Google Maps API?
I want to prevent the custom full screen behavior when you press the control without eliminating the UI. If the user clicks on the control the map will increase in size inside a container instead.
In case this is not possible, I wonder if the best way to achieve this would be to create an overlay attached to a click event.
Or may be I don't even need to use the overlay OverlayView class for this and I can manage it using only styles and the click event:
css:
#nav { z-index: 100; position: absolute; margin: 10px 0px 0px 200px;
background-color: #fff; border: 1px #000 Solid; padding: 5px; }
html:
<body onload="initialize();">
<div id="container">
<div id="nav" onclick="fullScreenCustomSize();">Nav Menu</div>
<div id="map"></div>
</div>
</body>
...
Source
Any suggestions on how would be the best way to achieve this?
Is there any way to intercept the default behaviour of the full screen control using the Google Maps API?
I want to prevent the custom full screen behavior when you press the control without eliminating the UI. If the user clicks on the control the map will increase in size inside a container instead.
In case this is not possible, I wonder if the best way to achieve this would be to create an overlay attached to a click event.
Or may be I don't even need to use the overlay OverlayView class for this and I can manage it using only styles and the click event:
css:
#nav { z-index: 100; position: absolute; margin: 10px 0px 0px 200px;
background-color: #fff; border: 1px #000 Solid; padding: 5px; }
html:
<body onload="initialize();">
<div id="container">
<div id="nav" onclick="fullScreenCustomSize();">Nav Menu</div>
<div id="map"></div>
</div>
</body>
...
Source
Any suggestions on how would be the best way to achieve this?
Share Improve this question edited Feb 4, 2018 at 22:35 rfc1484 asked Feb 4, 2018 at 22:05 rfc1484rfc1484 9,86717 gold badges77 silver badges125 bronze badges 2- 1 Are you after a fullscreen behaviour like this: lawa.nz if so, I guess you'll have to hide existing fullscreen button and add in your own that expands/shrinks the map container parent div? – Varinder Commented Feb 4, 2018 at 22:41
- As far as I can see the website you pointed out it seems to use openstreetmap instead of Google Maps but the desired effect is very similar to what I want to achieve (which would be the third option pointed out in the question). I'll take this solution if no better alternative es up. Thanks! – rfc1484 Commented Feb 5, 2018 at 8:04
1 Answer
Reset to default 3There is no documented way of changing the behavior of the full screen control. What I would do is:
- Remove the full screen button in the map options using
fullscreenControl: false
- Add your own button to the map UI using
map.controls
- Register your event to do whatever you need
Here is the documentation about controls and some examples.
本文标签: javascriptCustom full screen control behaviour with Google Maps APIStack Overflow
版权声明:本文标题:javascript - Custom full screen control behaviour with Google Maps API - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745392412a2656659.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论