javascript - 以无冲突的方式将 Bootstrap Accordion 添加到具有旧版本 jQuery 的网站

标签 javascript jquery html css twitter-bootstrap

我需要让我的 bootstrap accordion 正常工作,不知何故动画坏了,(它能工作但坏了)我怎样才能让它工作?

这可能是因为我包含了一个旧版本的 jquery,或者因为主题的创建者添加了一种自定义的方式来做这件事或其他什么,事情是,动画被打破了。

我还尝试添加 another accordion , 但它根本不起作用。

这是目前部分起作用的:

<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingOne">
      <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </a>
      </h4>
    </div>
    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
      <div class="panel-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingTwo">
      <h4 class="panel-title">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </a>
      </h4>
    </div>
    <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
      <div class="panel-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingThree">
      <h4 class="panel-title">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </a>
      </h4>
    </div>
    <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
      <div class="panel-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>

这是直接从 bootstrap 的示例中复制的,它可以工作,但动画有点破损,考虑到我无法添加新版本的 jQuery 而不破坏插件我的网站?

谢谢!

最佳答案

找到了一个使用 jquery-ui 的修复程序,所以答案是只包含 jquery-ui 的 accordion.js,here it is if anyone is interestedadding the jquery-ui markup for the accordion.

关于javascript - 以无冲突的方式将 Bootstrap Accordion 添加到具有旧版本 jQuery 的网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29608997/

相关文章:

javascript - 单击动态添加的 li 时无法显示 div 元素

php - 是否可以创建一个实时显示数据库内容的页面,在 Drupal 7 中更新而无需重新加载页面?

javascript - 书签覆盖CSS层?

jquery - 如何在select2下拉框中添加HTML内容

javascript - CSS 样式的单选按钮不响应键盘

php - 如何在不同的html表格位置插入动态行

javascript - 更改标题属性的字体系列

javascript - 使用 Q 进行 promises 轮询

javascript - 为什么付款实现在js中被认为是安全的?

java - 需要在页面加载时全屏显示托管的 html 页面