bootstrap popover 鼠标移至上面显示

html 元素中增加属性 data-toggle及data-content

 <label data-toggle="popover" data-content="111">测试</label>

  js中增加

 $(function () {
        $("[data-toggle='popover']").popover({
            trigger:'manual',
            placement : 'top',//弹出位置
            animation: false
        }).on("mouseenter", function () {
            var _this = this;
            $(this).popover("show");
            $(this).siblings(".popover").on("mouseleave", function () {
                $(_this).popover('hide');
            });
        }).on("mouseleave", function () {
            var _this = this;
            setTimeout(function () {
                if (!$(".popover:hover").length) {
                    $(_this).popover("hide")
                }
            }, 100);
        });
    });

  参考链接:https://www.jb51.net/article/87218.htm

posted on 2019-09-30 11:15  七七2020  阅读(1176)  评论(0编辑  收藏  举报

导航