【问题标题】:Bootstrap material design - Ripples not showing in popoverBootstrap 材料设计 - 波纹未显示在弹出窗口中
【发布时间】:2015-05-29 13:51:03
【问题描述】:

我正在使用引导材料设计:https://fezvrasta.github.io/bootstrap-material-design/bootstrap-elements.html

这包括在按下按钮时产生简洁的涟漪效果,这在我的页面中的任何地方都有效,除了在 html 中具有 display:none 但使用 javascript 对用户可见的弹出框 div 中。

HTML:

<a href="#" class="pop" data-id="#popover_div1" data-container="body" data-placement="top" title="Popover title">Click to open popover</a>
<div id="popover_div1" style="display: none">
    <div>
        <img class="img-rounded" src="img/temp.png" alt="temp" height="25" width="25"/>
        This is your div content
    </div>
    <div>
        <div class="btn-group">
            <a href="javascript:void(0)" class="btn btn-default">5</a>
            <a href="javascript:void(0)" class="btn btn-default">6</a>
            <a href="javascript:void(0)" class="btn btn-default">7</a>
        </div>
    </div>
</div>

JS:

$(".pop").popover({
    trigger: "manual", 
    html: true, 
    animation:false, 
    content: function() {
        return $($(this).attr('data-id')).html();
    }
}).on("mouseenter", function () {
    var _this = this;
    $(this).popover("show");
    $(".popover").on("mouseleave", function () {
        $(_this).popover('hide');
    });
}).on("mouseleave", function () {
    var _this = this;
    setTimeout(function () {
        if (!$(".popover:hover").length) {
            $(_this).popover("hide");
        }
    }, 200);
});

如果我去掉 style="display:none",涟漪效果会起作用,但包含它会使涟漪效果不适用于 div 内的按钮,真的很奇怪。有什么办法让我保持 display:none (因为弹出框的工作方式就像我想要的那样),但仍然会对 div 中的按钮产生涟漪效应?

【问题讨论】:

    标签: javascript html css twitter-bootstrap bootstrap-material-design


    【解决方案1】:

    在显示弹出窗口后尝试调用$.material.ripples()

    【讨论】:

      猜你喜欢
      • 2015-09-02
      • 2016-02-12
      • 1970-01-01
      • 1970-01-01
      • 2021-11-07
      • 2017-09-20
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      相关资源
      最近更新 更多