2013-03-06 89 views
0

在WordPress的網站,我有加載方面的類別和類別的內容。現在我的內容是用手風琴格式設置的。所以你有一個想法,我在這裏做了link我正在處理。我的問題是,你可以看到,當我點擊左側的一個類別時,第一次手風琴起作用,但是當我點擊另一個類別時,它完全混亂了。我已經試過幾件事情並沒有什麼doing..here是我到目前爲止有:Jquery UI手風琴,加載內容後不刷新

$(document).ready(function() { 
$('.categorias li').click(function(){ 
     var id = $(this).attr('id'); 
     $('#subtitle').html($(this).find('#title').html()); 
    $('#acc').html($('#' + id + '-content').html()).accordion({ 
      autoheight: false 

     }); 

}); 

我也曾嘗試:

$('#acc').html($('#' + id + '-content').html()) 
$('#acc').accordion(.accordion({ clearStyle: true }); 

但你可以看到什麼做什麼。有任何想法嗎?

+0

你的JavaScript返回一個錯誤:'遺漏的類型錯誤:無法讀取null' main.js的特性 'offsetWidth':29。試着先解決它:) – Xavier 2013-03-06 19:13:40

+0

不知道如何解決這個問題,但沒有認爲這對手風琴工作 – Andres 2013-03-06 20:13:54

回答

0

這可能會或可能不會幫助您簡化,但我想我會拋出如何處理手風琴菜單。它縮短了每個標籤之間...

<div id="right_area"> 
    <h3><a href="#">New Client Entry:</a></h3> 
     <div id="sub_cat"> 
      <h4><a href="#">this is sub:</a></h4> 
      <div>yo yo</div> 
      <h4><a href="#">this is sub:</a></h4> 
      <div>yo yo</div> 
     </div> 
    <h3><a href="#">Old Client Entry:</a></h3> 
    <div>hello there</div> 
</div> 



$(document).ready(function() { 
    $("#right_area").accordion({ 
     collapsible: true, 
     active: false, 
     clearStyle: true 
    }); 
    }); 


    $("#sub_cat").accordion({ 
     collapsible: true, 
     active: false, 
     clearStyle: true 
    }); 

http://jsfiddle.net/LSg36/2/