自定义手风琴禁用 jquery 中的点击

发布于 2024-12-17 09:39:13 字数 552 浏览 5 评论 0原文

无法禁用“活动”状态。有什么想法吗?

因此,当用户单击手风琴选项卡之一时,我希望禁用当前活动选项卡。

$(document).ready(function () {
    $(".accordion h5:first").addClass("active");
    $(".insides:not(:first)").hide();
    $(".insides:first").show();
    $(".accordion h5").click(function () {
        $(this).next(".insides").slideToggle("fast")
        //$(this).next("innards").slideToggle("fast")
        .siblings(".insides:visible").slideUp("fast");
        $(this).toggleClass("active");
        $(this).siblings("h5").removeClass("active");
    });
});

Having trouble disabling the "active" state. Any thoughts?

So when a user click on one of the accordion tabs, I would like to have the currect active tab disabled.

$(document).ready(function () {
    $(".accordion h5:first").addClass("active");
    $(".insides:not(:first)").hide();
    $(".insides:first").show();
    $(".accordion h5").click(function () {
        $(this).next(".insides").slideToggle("fast")
        //$(this).next("innards").slideToggle("fast")
        .siblings(".insides:visible").slideUp("fast");
        $(this).toggleClass("active");
        $(this).siblings("h5").removeClass("active");
    });
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰葑 2024-12-24 09:39:13
  1. 禁用/隐藏所有其他手风琴
  2. 活动/显示选定的手风琴
  1. Disable/hide all other accordions
  2. Active/ show selected accordion
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文