javascript - JqueryUI Google Map will not Resize unless clicked -


i have written click function resizes , recenters map when map clicked.

is there way make function run automatically when tab loads? function.

            mapresize = function () {                 var mapfirstclick = false;                 var center = new google.maps.latlng(32.565243, -97.130531);                 $("#tabs-4").click(function() {                     mapfirstclick || settimeout(function() {                         google.maps.event.trigger(map, 'resize');                         mapfirstclick = true;                         map.setcenter(center);                     }, 250);                 });             }, 

you can see how acts @ http://l2technotes.dyndns.org clicking on location tab, map not load correctly if click on map resizes , recenters correctly tells me click function working.

as always, guidance appreciated.

first of all: using jqueryui 1.10 . of ressources you'll find on web refer 1.8 there have been major changes, e.g. in 1.10 there no longer show-event, use activate instead:

    $('#tabs').tabs({         activate: function (event, ui) {                     if (ui.newpanel.attr('id') =='tabs-4') {                       ui.newpanel.click();                     }                   }     }); 

the documentation 1.10 you'll find here: http://api.jqueryui.com/1.10/tabs/


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -