【问题标题】:jquery toggle multiple divs turning one on and the rest offjquery切换多个div打开一个,其余的关闭
【发布时间】:2010-01-29 07:36:17
【问题描述】:

您好, I'm trying to think of a way to use an accordion widget (which I'm currently using, h3 is the trigger) that when an h3 is selected another div appears, then when a different h3 is selected, a new div appears and另一个消失等等。

so I have a three column layout, left column is my accordion widget, when the h3 is selected a middle div will appear (animation doesn't matter) and a floating right column within that div to give the appearance of a three列布局,右列将用于显示/隐藏该中间 div 中的内容。还和我在一起????

Keep in mind that the first h3 is open by default, so there would be a related middle column open as well and floating right column as well within but will disappear when another h3 is selected and so on.

我的 jquery/javascript 充其量是最小的,我想不出任何方向。

我是否使用切换?显示隐藏?任何想法将不胜感激!

所以我想我想要做的是在用户单击链接而不是显示项目清单/内容。

【问题讨论】:

  • 你真的需要发布一些代码,它会让人们更容易帮助你。
  • 甚至可以粘贴图片,MSPaint 风格:)

标签: jquery toggle html show-hide slidetoggle


【解决方案1】:

根据您的描述,我编写了一个小示例。请查看此作为起点,如有任何问题,请发表评论。希望这对您来说是一个很好的起点。

查看确切代码的源代码。

http://jsbin.com/ixaco

【讨论】:

    【解决方案2】:

    谢谢 T B,这正是我想要的。使用您提供的代码,您能否说出是否可以将 Jquery Ui 效果添加到显示/隐藏的填充 div 中?正在考虑像盲目的效果或什么的。很好奇,因为我已经将 UI 手风琴小部件用作我的左栏。以防有人想知道我为什么要调用 UI 库。

    你的代码:

    $(function(){
      $("h3").click(function(){
        $(".content").hide();
        $(this).next().show();
      });
      $("h3:first").click();
    });
    
    #

    如果我添加“盲”:

       $(".content").hide(blind);
        $(this).next().show(blind);
    

    我想是这样的……基本上只是为了稍微花哨

    再次感谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多