【问题标题】:Twitter Bootstrap 3 customized radio buttons crashed by fastclick.jsTwitter Bootstrap 3 自定义单选按钮被 fastclick.js 崩溃
【发布时间】:2014-12-03 00:15:14
【问题描述】:

我使用这个 code 女巫,当我单独使用它时效果很好(没有 fastclick 插件):

<div class="btn-group" data-toggle="buttons">
    <label class="btn btn-primary active">
        <input type="radio" name="options" id="option1" checked> Option 1 (preselected)
    </label>
    <label class="btn btn-primary">
        <input type="radio" name="options" id="option2"> Option 2
    </label>
    <label class="btn btn-primary">
        <input type="radio" name="options" id="option3"> Option 3
    </label>
</div>

但是当我使用 fastlick.js 来提高移动设备的点击性能时,当我按下按钮时,活动类会从一个标签更改为另一个标签,但单选按钮没有更新,它仍然是选中的同一个单选。

我花了一些时间才弄清楚,我必须使用以下方法使单选按钮可见:

[data-toggle="buttons"] > .btn > input[type="radio"], [data-toggle="buttons"] > .btn > input[type="checkbox"] {
    display: block;
}

然后我看到输入收音机仍然静止。你可以用ipad或iphone打开this jsfiddle example查看问题。

是否有任何解决方案可以使单选按钮工作并同时保留 fastclick.js 插件?

【问题讨论】:

  • 小提琴不可行,因为FastClick is not defined.. 但据我所知,引导程序javascript radio button 使用 jQuery 设置值并添加更改处理程序,而 fastclick 以普通方式执行此操作。跨度>
  • 我已经更新了示例中的 fastclick 插件,现在应该可以使用了。

标签: html css twitter-bootstrap twitter-bootstrap-3 fastclick.js


【解决方案1】:

...正如 fastclick 建议的那样,将“needsclick”类添加到包装器 btn-group...

<div class="btn-group needsclick" ...>

【讨论】:

    猜你喜欢
    • 2014-04-24
    • 2013-08-02
    • 2013-04-19
    • 1970-01-01
    • 2013-02-28
    • 2013-11-27
    • 1970-01-01
    • 2012-12-23
    • 2014-07-21
    相关资源
    最近更新 更多