有没有办法在悬停时保持弹出显示(悬停触发器)? [英] Is there a way to keep the popover displaying when hover on it (whith hover trigger)?

查看:31
本文介绍了有没有办法在悬停时保持弹出显示(悬停触发器)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法让用户悬停在弹出框上时保持显示(我的意思是,不仅是触发元素,还有弹出框本身)?

I m wondering if there is a way to keep the popover displaying when the user hover on it (i mean, not only the trigger element but the popover itself)?

在我的例子中,我的 popover content 中有一个链接,但是用户无法点击它,因为 popover 在离开 时会隐藏自己悬停 触发 elelement(hover trigger)...

In my case, i have a link inside my popover content, but the user can't click it, because the popover hides itself when leaving the hover trigger elelement(hover trigger)...

推荐答案

我还没有看到任何带有 hover 触发器的解决方案这是我使用 这个问题

I haven't seen any solution yet with hover trigger here is my solution with manual trigger from this question

$('.selector').popover({
        html: true,
        trigger: 'manual',
        container: $(this).attr('id'),
        placement: 'top',
        content: function () {
            $return = '<div class="hover-hovercard"></div>';
        }
    }).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);
    });

这篇关于有没有办法在悬停时保持弹出显示(悬停触发器)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆