【问题标题】:Bootstrap popover with dynamic content breaks custom checkbox CSS functionality具有动态内容的 Bootstrap 弹出窗口会破坏自定义复选框 CSS 功能
【发布时间】:2015-09-10 00:11:02
【问题描述】:

请看my sample code

我有使用 Font Awesome 图标的自定义复选框。在我使用加载到 document.ready 上的自定义弹出框内容之前,一切正常。

当以这种方式加载内容时(而不是直接在锚元素中指定内容),复选框停止工作(无法检查它们)。

有什么想法吗?

这里是working example,里面直接设置了内容。

仅供参考,让 Font Awesome 复选框看起来像是被选中的相关 CSS 代码是:

input[type=checkbox]:checked + label:before { content: "\f046"; }

【问题讨论】:

    标签: css twitter-bootstrap-3 font-awesome popover


    【解决方案1】:

    应用此 CSS。

    input[type="checkbox"] {
    display: block;
    height: 21px;
    opacity: 0;
    position: absolute;
    width: 20px;
    left:0;
    top:0;
    z-index: 999;}
    .test{position:relative}
    

    还有 HTML

    <div class="test"><input id="box1" type="checkbox" />
    <label for="box1">Checkbox 1</label>
    </div>
    <div class="test">
        <input id="box1" type="checkbox" />
        <label for="box1">Checkbox 2</label>
    </div>
    <div class="test">
        <input id="box1" type="checkbox" />
        <label for="box1">Checkbox 3</label>
    </div>
    

    【讨论】:

    • 你实际测试过这个吗?如果是这样,您能否提供工作代码的链接?
    • 太好了,谢谢!我实际上重构了我的代码并让它以不同的方式工作。但你的答案有效!
    • 标签呢?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-06
    相关资源
    最近更新 更多