npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bootstrap-tooltip-custom-class

v1.1.0

Published

Extends Bootstrap Tooltips and Popovers by adding custom classes.

Downloads

357

Readme

Bootstrap Tooltip Custom Class

Extends Bootstrap Tooltips and Popovers by adding custom classes. Available for Bootstrap 3 and Bootstrap 4.

Define your own custom class or use the predefined custom classes:

  • tooltips: .tooltip-primary, .tooltip-success, .tooltip-info, .tooltip-warning, .tooltip-danger.
  • popovers: .popover-primary, .popover-success, .popover-info, .popover-warning, .popover-danger.

Bootstrap Tooltip Custom Class Preview

Bootstrap Popover Custom Class Preview

In Bootstrap 4, the predefined tooltips and popovers are built from the $theme-colors map, so there are 3 more custom classes:

  • tooltips: .tooltip-secondary, .tooltip-light, .tooltip-dark.
  • popovers: .popover-secondary, .popover-light, .popover-dark.

Installation

To install latest version via npm run:

npm install bootstrap-tooltip-custom-class

or via yarn run:

yarn add bootstrap-tooltip-custom-class

Setup

The implementations for Tooltips and Popovers are independent. You can include them together or you can use them separately.

Use the appropriate files according to Bootstrap version that you use: bootstrap-v3, bootstrap-v4 or bootstrap-v4-alpha.

Tooltips

CSS

Include bootstrap-tooltip-custom-class.css in your project or use the .scss file:

<link rel="stylesheet" href="bootstrap-tooltip-custom-class.css" media="all" />

SASS:

@import "bootstrap-tooltip-custom-class";

Use the mixin tooltip-custom to create styles for your custom tooltip:

.tooltip-custom {
  @include tooltip-custom(#f2653c, #fff);
}

Less (only for Bootstrap v3):

@import "bootstrap-tooltip-custom-class.less";

Use the mixin tooltip-custom:

.tooltip-custom {
  .tooltip-custom(#f2653c, #fff);
}

Javascript

Include the script after Bootstrap's main javascript file:

<script src="bootstrap.js"></script>
<script src="bootstrap-tooltip-custom-class.js"></script>

Popovers

CSS

Include bootstrap-popover-custom-class.css in your project or use the .scss file:

<link rel="stylesheet" href="bootstrap-popover-custom-class.css" media="all" />

SASS:

@import "bootstrap-popover-custom-class";

Use the mixin popover-custom to create styles for your custom popover:

.popover-custom {
  @include popover-custom(#f2653c, #fff);
}

Less (only for Bootstrap v3):

@import "bootstrap-popover-custom-class.less";

Use the mixin popover-custom:

.popover-custom {
  .popover-custom(#f2653c, #fff);
}

Javascript

Include the script after Bootstrap's main javascript file:

<script src="bootstrap.js"></script>
<script src="bootstrap-popover-custom-class.js"></script>

Usage

  • Use data-custom-class attribute:
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" data-custom-class="tooltip-custom" title="Custom tooltip example">Tooltip example</button>
<button type="button" class="btn btn-default" data-toggle="popover" data-placement="top" data-custom-class="popover-custom" title="Custom popover example" data-content="Vivamus sagittis lacus vel augue laoreet">Popover example</button>

or

  • Use customClass parameter on plugin initialization:
$(function () {
  $('.has-tooltip').tooltip({
    customClass: 'tooltip-custom'
  });
});
$(function () {
  $('.has-popover').popover({
    customClass: 'popover-custom'
  });
});

Demo

Local

Local demo files can be found in the demo folder of each project. First, execute the following instructions in the root:

$ npm install
$ npm run install-#project_alias# (or) npm run install-all
$ npm run build-#project_alias# (or) npm run build-all

(project_alias = v3 / v4 / v4-alpha)

Online