在悬停时出现Bootstrap Popover / Disappear而不是Click [英] Make Bootstrap Popover Appear/Disappear on Hover instead of Click

查看:191
本文介绍了在悬停时出现Bootstrap Popover / Disappear而不是Click的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Bootstrap的 Popover 建立一个网站,我无法弄清楚如何制作弹出窗口出现在悬停而不是点击。

I'm building a website with Bootstrap's Popover and I can't figure out how to make the popover appear on hover instead of click.

我想要做的就是当有人将鼠标悬停在某个链接上而不是点击它并弹出窗口时,会出现一个弹出窗口当他们离开时消失。文档说明可以使用data属性或jquery。因为我有多个弹出窗口,所以我宁愿用jquery做这件事。

All I want to do is have a popover appear when someone hovers over a link instead of clicking on it and for the popover to disappear when they move away. The documentation says it's possible using either the data attribute or jquery. I'd much rather do it with jquery since I have multiple popovers.

推荐答案

将popover的触发器选项设置为 hover 而不是点击,这是默认一。

Set the trigger option of the popover to hover instead of click, which is the default one.

这可以使用数据完成 - * 属性:

<a id="popover" data-trigger="hover">Popover</a>

或者使用初始化选项:

$("#popover").popover({ trigger: "hover" });

这是一个 DEMO

Here's a DEMO.

这篇关于在悬停时出现Bootstrap Popover / Disappear而不是Click的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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