0

このタグをクリックすると、ポップアップが開きます

<span class="en_US tk-museo-sans locale-select-lable">United States</span>

ポップアップ内のリンクをクリックすると、ポップアップが閉じます

<span class="selectorCountries locale-link">united states</span>
<span class="selectorCountries marginSecondCountry locale-link">canada</span>
<span class="selectorCountries marginCanadaFrench locale-link">canada(french)</span>

問題は、このタグのポップアップ内のリンクをクリックしたときです

<span class="en_US tk-museo-sans locale-select-lable">United States</span> 

国名に置き換える必要があります...

問題はjqueryコードにあります...

http://jsfiddle.net/6QXGG/145/

直し方教えてくれませんか...

私は最新のjsコードを提供しています

    // locale selector actions
    $('#region-picker').click(function(){
            if ($("#locale-select").is(":visible")) return closeSelector('slide');


        var foot_height = $('#footer').innerHeight();
        var foot_height_css = foot_height-1;
        var select_position = '-=' + (Number(700)+18);
        console.log("hallo"+select_position);
        var $selector = $('#locale-select');
        $('#locale_pop').fadeOut();
        $selector.css({top:foot_height_css});
        $selector.fadeIn(function(){
            $(this).addClass('open');
            $(this).animate({top:select_position}, 1000);
            });
    });
    $('#select-tab').click(function(e){
        e.stopPropagation()
        closeSelector('slide');
        });
    // don't hide when clicked within the box
    $('#locale-select').click(function(e){
        e.stopPropagation();
    });
    $(document).click(function(){ 
        if ($('#locale-select').hasClass('open')) {
            closeSelector('disappear');
        }
    });

    $('.locale-link').click(function(){
        if ($("#locale-select").is(":visible")) return closeSelector('slide');
       /*         
       // var desired_locale = $(this).attr('rel');
       // createCookie('desired-locale',desired_locale,360);
       // createCookie('buy_flow_locale',desired_locale,360);
        //closeSelector('disappear');
        */
    })

    $('#locale_pop a.close').click(function(){
        var show_blip_count = readCookie('show_blip_count');
        if (!show_blip_count) {
            createCookie('show_blip_count',3,360);
        }
        else if (show_blip_count < 3 ) {
            eraseCookie('show_blip_count');
            createCookie('show_blip_count',3,360);
        }
        $('#locale_pop').slideUp();
        return false;
    });

function closeSelector(hide_type){
var foot_height = $('#footer').innerHeight();
var select_position = '+=' + (Number(400)+20);
if (hide_type == 'slide') {
$('#locale-select').animate({top:select_position}, 1000, function(){
$(this).removeClass('open');
$(this).fadeOut()
});
}
else if (hide_type == 'disappear'){
$('#locale-select').fadeOut('fast');
$('#locale-select').removeClass('open');
}
}

</p>

4

1 に答える 1

0

これはどう?

 $('.locale-link').click(function(){
        $("#region-picker:first-child").text(this.text());
        if ($("#locale-select").is(":visible")) return closeSelector('slide');
   })
于 2012-10-24T05:01:50.110 に答える