0

所以我忙着为我的客户使用 Jquery 手风琴创建一个时事通讯档案。每个月本质上都是一个手风琴(所以这个月本身是可扩展和可折叠的),每篇文章也是如此。我的第一个月(一月)运行良好,但由于某种原因,其他月份都没有按预期工作。其他“月份”可以展开和折叠,但他们的文章不能。我无数次尝试修改Javascript,但无济于事。

这是测试站点的链接:http: //promisedev.co.za/eam/gt/

如果有人有任何建议或意见,将不胜感激!

4

3 回答 3

0

您所要做的就是删除内联样式,例如height: 154pxandheight: 0并在本地/外部 css 中设置高度:

<style>
    .akordeon-item-body { height: 154px; }
</style>
于 2013-10-18T09:46:14.500 回答
0

我认为问题出在您的jquery.akordeon.js文件上。您可以删除此文件并使用此 JQuery 代码。我编辑了您的代码,您可以使用它:

jsFiddle 在这里

$(document).ready(function(){
//Hide the tooglebox when page load
$(".togglebox").hide();
$(".togglebox:first").show();
    $(".akordeon-item-head").next(".akordeon-item-body").hide();
//slide up and down when click over heading 2
$("h1").click(function(){
// slide toggle effect set to slow you can set it to fast too.
$(this).next(".togglebox").slideToggle("slow");
return true;
});
    /* here is the new Codes*/
    $(".akordeon-item-head").click(function(){

        $(this).next(".akordeon-item-body").slideToggle();

    });   
});
于 2013-10-18T09:42:02.220 回答
0

我不得不在某个站点上使用手风琴机制,最后我自己编码

小提琴测试用例 <这里>

重要的部分是存储最后一个滑动元素

$("#commonAncestor").on('click', function (e) {
    var $me = $(this),
        $clicked = $(e.target).closest('.clickableArea', this),
        $lastClicked = $me.data('active') || $([]),
        ...
});
于 2013-10-18T09:48:53.260 回答