2010-12-16 16 views
0

因此,我有一個jQuery手風琴,並在內容區域中創建了一些使用圖像的僞複選框。這適用於所有瀏覽器,但IE 6/7(很不幸,我必須支持)。當我切換關閉/打開部分時,會發生什麼情況,複選框出現在通過動畫完全打開內容之前。一種選擇是禁用IE的動​​畫,但我寧願不這樣做。相反,我希望有一種方法可以通過change/changestart函數顯示/隱藏複選框。但是,似乎這樣做,我需要在changestart函數中找出內容即將展開還是即將崩潰的內容。如果它崩潰了,我需要在動畫開始之前隱藏複選框。同樣,在更改函數(完成時執行的函數)中,我需要查看內容是打開還是關閉。如果它被打開,那麼我們會想顯示其中的複選框。這是我現在正在嘗試的,但它所能做的只是隱藏它,而且它總是這樣做,所以我正在考慮將它放在.ui-accordion-content-active類中不起作用:找出jQuery中的內容活動手風琴上的更改事件

$("#filter_accordion").accordion({ 
    header: "> div > h3", 
    autoHeight: false, 
    collapsible: true, 
    active: false, 
    change: function(event, ui) { 
     if (ui.newContent.hasClass(".ui-accordion-content-active")) ui.newContent.find(".checkbox").show(); 
    }, 
    changestart: function(event, ui) { 
     if (!(ui.newContent.hasClass(".ui-accordion-content-active"))) ui.newContent.find(".checkbox").hide(); 
    } 
    }); 

任何幫助,非常感謝!

回答

0

好吧,從來沒有得到任何迴應,但萬一有人跑過它,我找到了一個解決方案。 UI圖標的可見性與另一個在擴展/摺疊節時垂直移動圖標的IE錯誤有關。 ie67只是我模板中的一個布爾值集合,用於描述我們是否使用其中一種瀏覽器(IE 6/7),以防不明顯。

$("#filter_accordion").accordion({ 
    header: "> div > h3", 
    autoHeight: false, 
    collapsible: true, 
    active: false, 
    changestart: function(event, ui) { 
     if (ie67) { 
     $("#filter_accordion .ui-icon").css("visibility", "hidden"); 
     ui.oldContent.find(".checkbox").hide(); 
     if (ui.newContent.is(":visible")) ui.newContent.find(".checkbox").hide(); 
     } 
    }, 
    change: function(event, ui) { 
     if (ie67) { 
     $("#filter_accordion .ui-icon").css("visibility", "visible"); 
     if (ui.newContent.is(":visible")) ui.newContent.find(".checkbox").show(); 
     } 
    } 
    });