javascript - Userscript: Trigger Google Map resize? -


i'm building userscript (script install in browser modify 3rd party pages) geoguessr.com. adds button allows expand small guess map fullscreen.

while had no problems layout, issue google map not resize:

enter image description here

the page built backbone , not have api access of views, less internal google maps object.

i tried

$(window).trigger('resize'); 

to trigger window resize event because noticed when manually map resizes. yet nothing happens (chrome 29).

is there way force google map resize in userscript?

if resize div container of map, must resize map object itself. stated in reference:

developers should trigger event on map when div changes size: google.maps.event.trigger(map, 'resize').

where map variable name of google.maps.map object. (which i'm guessing can access if it's in global namespace).

update:

first thing first, access properties built backbone.view.extends need access prototype of class - in case window.gg.guessmapview.prototype. next need specify el view use. because generated backbone view - should - have no access it. see article more info. want attach existing html element it, #guessmapcontainer element.

window.gg.guessmapview.prototype.$el = $('#guessmapcontainer') 

once element specified want re-initialize view renders map again. can done initialize() method implemented view.

window.gg.guessmapview.prototype.initialize() 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -