oeco / jeo

A WordPress parent theme for interactive maps and journalism
http://jeowp.org/
Other
90 stars 33 forks source link

Full Screen map as default? #62

Closed fariskassim closed 10 years ago

fariskassim commented 10 years ago

How can i - options or coding wise - make the map load a full screen version by default (instead of having to click the button on the controls.)

Any idea?

I see that there is a fullscreen.js file making this happen when the button is clicked? How can i make this run by default?

kingstakh commented 10 years ago

You can set as default page with fullscreen hash like this http://yoursite.com/#!/full=true

fariskassim commented 10 years ago

@kingstakh hmm. but im trying not to enable Fragment Hash. can i put some sort of js codes in my js files or footer to make the website load fullscreen on load?

i tried making the map container 100% height. but there's still a weird cut off at the bottom unless i move the map up with my mouse, resize, or click on full screen.

http://fariskassim.com/stage/tcrp/v1/category/map-all-causes

miguelpeixe commented 10 years ago

@fariskassim

As you can see here, the fullscreen toggler is a leaflet control. You can programmatically toggle it like this:

jeo.mapReady(function(map) {
  map.fullscreen.toggle();
});

All the fullscreen toggler does is add classes to the body and the map container so we can perform fullscreen behaviour css-only. So you can also simply change your css to give your maps your desired default styles.

fariskassim commented 10 years ago

@miguelpeixe

thanks for your reply.

what i did was to enable Fragment Hash in settings and have this script in the header of my page,

location.hash = "#!/full=true"; window.location = location.hash;