简体   繁体   English

Jquery:最小化选项卡内容的手风琴选项卡

[英]Jquery: minimize accordion tabs onclick of a tab content

I am looking for a possibility to minimize other accordion tabs if I receive a onclick in one of the accordion content if its minimized I want to keep only a bar down the screen, if user clicks on this the accordion is being shown again. 我正在寻找一种可能性来最小化其他手风琴选项卡,如果我收到其中一个手风琴内容的onclick如果它最小化我想在屏幕上只保留一个条,如果用户点击这个,手风琴再次显示。 Found this ( jQuery accordion hiding tabs in CSS ) but no what I want. 发现这个( jQuery手风琴隐藏CSS中的标签 )但没有我想要的。

Anybody has some experience on how to do this on easy way? 有人在如何轻松实现这一目标方面有一些经验吗?

I prefer to wrap it up in the accordion creation, like shere: 我更喜欢将其包含在手风琴创作中,如:

$accordion.accordion({
            autoHeight: false,
            heightStyle: "fill",
            activate: function (event, ui) {
                json = [];
                it = {};
                it["id"] = ui.newHeader.attr('id');
                it["filter"] = 0;
                it["search"] = $("#txt_search").val();
                json.push(it);
                var header = ui.newHeader.attr('id').split('_');
                var body = ui.newHeader.attr('id').substr(2);
                body = body.substr(0, body.lastIndexOf('_'));
                //iTransactionHandler(14, body, header[header.length - 1], json);
            },
            beforeActivate: function (event, ui) {
                alert($(this).find('.ui-state-active').next().attr('id'));
            }
        });

It sounds like the "not" function twinned with the "each" function might just be what you're looking for 听起来像“不”功能与“每个”功能结合可能只是你正在寻找的东西

$(".tab").click(function() {
    $(".tab").not($(this)).each(function() {
        $(this).close();
    });
});


function close() {
    console.log('close')
}

What this does is says "Close all tabs except the one that was just clicked." 这样做是说“关闭所有选项卡,除了刚刚点击的选项卡。”

If that doesn't answer your question; 如果这不能回答你的问题; you're going to have to provide more information because it looks like you're just asking us to write you an accordion. 你将不得不提供更多信息,因为看起来你只是要求我们给你写手风琴。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM