javascript - Phonegap -Leaflat map fill up remaining site -
i using leaflat display map, want fill remaining space, wanted use flex boxes, map not displayed, displaey if define height in px.
javascript
var map = l.map('map').setview([51.505, -0.09], 13); l.tilelayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', { maxzoom: 18, attribution: 'map data © <a href="http://openstreetmap.org">openstreetmap</a> contributors, ' + '<a href="http://creativecommons.org/licenses/by-sa/2.0/">cc-by-sa</a>, ' + 'imagery © <a href="http://mapbox.com">mapbox</a>', id: 'examples.map-i875mjb7' }).addto(map); css
body { padding: 0 !important; margin: 0 !important; height: 100% !important; display: flex !important; flex-flow: column wrap !important; height: 100% !important; } #content { width: 100%; height: 100%; } .content-box {} .content-box .run {} .content-box .run.data { order: 1; flex: 0 1 auto; } .content-box .run.data > h1 { text-align: center; } .content-box .run.map { order: 2; flex: 1 1 auto; width: 100%; } html
<!doctype html> <html> <head> <meta charset="utf-8" /> <title>app</title> <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> <link href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" rel="stylesheet" /> </head> <body> <div id="app"> <div id="content" class="content-box"> <div class="run data"> <p>some content</p> <p>....</p> </div> <div class="run map" id="map"> </div> </div> </div> </body> </html> i have tried several things similar questions here on stackoverflow none of them solve problem. if add position: fixed; #content in css file , add height: 100%; .content-box .run-map map sized correctly @ first moment, after clicking comething glitches , no longer correctly, tried position: fixed; had not helped. how can make map fill rest of site?
what did set html height 100%.
html { height: 100%; }
Comments
Post a Comment