Search code examples
jquerygoogle-mapsjquery-tabs

Google Maps and jQuery Tabs and Size show


I have problem with Google maps included in simple jQuery Tabs to show.

if data in tabs have many line show simple jQuery have scollbar , how auto size tab ?

Below I pasted the code:

jQuery:

$(document).ready(function() {

//Default Action
$(".tab_content").css({'visibility':'hidden'  , 'position':'absolute'});
$("ul.tabs li:first").addClass("active").show(); 
$(".tab_content:first").css({'visibility':'visible' , 'position':'static'}); 

//On Click Event
$("ul.tabs li").click(function() {
    $("ul.tabs li").removeClass("active");
    $(this).addClass("active"); 
    $(".tab_content").css({'visibility':'hidden' , 'position':'absolute'}); 
    var activeTab = $(this).find("a").attr("href"); 
    $(activeTab).css({'visibility':'visible'  , 'position':'static'});
    return false;
});

});

if I pasted the below code , simple jQuery auto size tab but google map show a mistake.

$(document).ready(function() {

//Default Action
$(".tab_content").hide();
$("ul.tabs li:first").addClass("active").show(); 
$(".tab_content:first").show(); 

//On Click Event
$("ul.tabs li").click(function() {
    $("ul.tabs li").removeClass("active");
    $(this).addClass("active"); 
    $(".tab_content").hide(); 
    var activeTab = $(this).find("a").attr("href"); 
    $(activeTab).fadeIn();
    return false;
});

});

I really don't know what to do to. Is that a general problem with google maps or there is something with my tabs?

Thank you for your help in advance


Solution

  • I'm editing and susses

    $(document).ready(function() {
        //Default Action
        
        $(".tab_content").hide();
        $("ul.tabs li:first").addClass("active").show();
        $(".tab_content:first").show(); 
    
        //On Click Event
        $("ul.tabs li").click(function() {
            $("ul.tabs li").removeClass("active");
            $(this).addClass("active");
            $(".tab_content").hide();
            var activeTab = $(this).find("a").attr("href");
            $(activeTab).fadeIn();
            if(activeTab == '#tab2') {
                $(window).resize(function(){
                //$("#tab2").css({'display':'block'});
                //$("#map_canvas").css({'width':'630px', 'height':'400px'});
                //initialize();
                //alert('Changed!');
                });
                }
            return false;
        });
    });