开发者

Tab content(Google map) initialization problem

I want to create Multiple dynamic Tabs with different google maps in each tabs.Also the the map should not initialize every time Tab clicks...My codings are below... Actually my problem is the Map initialized every time i click on Tabs...How to clear this issue...

//Function to create Tab dynamically

 function addTab(link,name) {
    $("#content").append("<div id='" + $(link)开发者_StackOverflow中文版.attr("value") +         "_content'style='width:100%;height:100%'></div>");
    var mid = $(link).attr("value")+"_content";

    tab1map(mid);

    $("#" + $(link).attr("value") + "_content").show();
}

//function for click event of Tabs

$('#tabs a.tab').live('click', function() {

    $("#content div").hide();

    $("#" + contentname).show();   // Here "contentname" is the id of the above Div tag when creating Tab
    tab1map(contentname);            //Here the Map function called again 
     // Here We should not call this map function again....the Map will Display with existing content in the $("#" + contentname).show(); itself..but it is not displayed....
 }             

// Map Function  
function tab1map(mid) {
         var map = new google.maps.Map(document.getElementById(mid), myOptions);
}

Also I have tried google.maps.event.trigger(map, 'resize'); in click event of Tabs..But this also not working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜