2012-10-24 167 views
0

有幾個鏈接替換span標籤當我點擊這個標籤彈出打開通過點擊

<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/

u能告訴我如何解決它......

我提供我最新的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'); 
} 
} 

+0

did you mean to do this? $(document).click(function(){('('#locale-select')。hasClass('open')){ closeSelector('disappear'); } }); 你想在Window.Document上點擊事件處理程序? – awright18

+0

@ awright18:謝謝你的回覆.... http://www.teslamotors.com/在這個鏈接當他們點擊不同國家的鏈接時,國旗圖片的變化對應於不同的國家....但是這裏我想替換與不同的國家名稱... – js00831

+0

我沒有看到任何地方選擇一個conuntry – awright18

回答

0

這個怎麼樣?

$('.locale-link').click(function(){ 
     $("#region-picker:first-child").text(this.text()); 
     if ($("#locale-select").is(":visible")) return closeSelector('slide'); 
    }) 
+0

http://jsfiddle.net/6QXGG/146/embedded/result/在這裏你可以看到紅色的按鈕...當我點擊國家名稱的鏈接...我希望它被取代與相應的國家名稱......在評論我後,如果我點擊鏈接彈出不關閉... – js00831

+0

你的代碼不工作這一個工程http://jsfiddle.net/5dedF/ – js00831

+1

很高興你知道它的意思出。 – awright18