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 回答