【问题标题】:Bootstrap data-toggle doesn't work with ember component引导数据切换不适用于 ember 组件
【发布时间】:2016-12-06 18:28:09
【问题描述】:

我有一个创建以下 html 的 jquery 插件

<div class="panel-heading">
  <h4 class="">
    <a data-toggle="collapse" href="#collapse2" class="collapsible-title display-inline full-width bold">Select Gigs</a>
  </h4>
</div>
<div id="collapse2" class="panel-collapse collapse">
  <div class="panel-body">
    <div class="row">
      <div class="col-xs-12">
        <input type="text" class="input-text-field margin-medium-bottom" placeholder="Search" />
      </div>
    </div>
...... and some other divs here .....

当点击上面的&lt;a&gt;&lt;/a&gt; 时,我想切换 id 为 collapse2 的 div。如果我在hbs 文件中添加html,它工作正常。但是当我在 jquery 中创建上面的 html 并按如下方式插入 DOM 时,它将 url 更改为 domain/#collapse2

    _initializeAutoComplete: function () {
        Ember.$('#' + this.get('divId')).setAutocomplete({
            data: this.get('dataTree'),
            multiSelect: true,
            selectingType: 3
        });

    }.on('didInsertElement')
});

如何在不将 ember 作为 url 更改为 href 的情况下进行切换? 感谢任何帮助。

【问题讨论】:

    标签: javascript jquery html twitter-bootstrap ember.js


    【解决方案1】:

    将引导属性移动到上面的 div (或 h4 或根据需要创建新的)

    <div class="panel-heading" data-toggle="collapse" href="#collapse2" class="collapsible-title display-inline full-width bold">
      <h4 class="">
        <a href="#">Select Gigs</a>
      </h4>
    </div>
    

    【讨论】:

      猜你喜欢
      • 2016-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-13
      • 1970-01-01
      • 2015-08-18
      • 1970-01-01
      • 2017-07-01
      相关资源
      最近更新 更多