html - 为每个元素引导 4 种不同的弹出框和工具提示样式

标签 html css tooltip popover using

我想为 Bootstrap 4 上的每个部分的工具提示和弹出框元素提供不同的样式例如:

此元素的颜色和其他 css 选项:

<div class="first-type">
    <div data-toggle="popover" data-trigger="hover" title="About Us" data-placement="left">
        <a href="#about" class="item-class"></a>
    </div>
</div>

还有这个元素的另一个 css 选项:

<div class="second-type">
    <div data-toggle="popover" data-trigger="hover" title="Services" data-placement="left">
        <a href="#services" class="item-class"></a>
    </div>
</div>

Bootstrap 3x 将弹出窗口代码添加到元素中。我可以用元素的类轻松地给样式。但是 Bootstrap 4 将弹出代码添加到正文中。我该如何解决这个问题?

最佳答案

通过 js:

$(document).ready(function(){
    $('[data-toggle="popover"]').popover({
        trigger: 'click',
        template: '<div class="popover awesome-popover-class"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
    });  
});

关于html - 为每个元素引导 4 种不同的弹出框和工具提示样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49231187/

相关文章:

javascript - $(...).tooltip 无法工作,因为 jQuery 1.9.2 由于旧的 jQuery UI 1.8.16 库而无法工作?如何解决这个问题?

html - 在 HTML 中看不到省略号

html - 在下面的标题和文本中使用两个单独的部分制作消息

html - 只有 Chrome 破坏了我的网站格式

Javascript 函数无法获取高度 css 属性

html - 难以设置 Bootstrap 导航栏

css - 在垂直 flex 容器中水平对齐 flex 元素

html - Bootstrap 字体很棒的图标在下载的 CSS 中不起作用

ios - 触摸并按住 TableViewCell 以显示(工具提示)弹出窗口在 iPhone 中是否可行?

vb.net - 显示文本框工具提示