[DEPRECATED] d3-friendly versions of Twitter bootstrap JavaScript tools
Makefile
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
examples
.gitignore
LICENSE
Makefile
README.md
bootstrap-alert.js
bootstrap-popover.js
bootstrap-tooltip.js
component.json
d3-bootstrap.js
d3-bootstrap.min.js
d3-compat.js
d3-compat.min.js

README.md

⚠️ This repository is no longer maintained ⚠️

Please see sebt3/d3-bootstrap, an implementation that supports D3 v4.

d3-bootstrap

Twitter's Bootstrap is an awesome CSS framework with some really nice JavaScript tools. The problem with these tools, though, is that they rely heavily on jQuery, while d3 provides (approximately) 99% of the functionality they require.

At first I considered a shim for $ that would expose a more jQuery-like facade on top of d3, but that quickly got messy. Instead, I decided to start rewriting each of Bootstrap's tools from scratch and in a more d3-friendly style. For example, Bootstrap's tooltips:

$("a.tt").tooltip({
  placement: "right"
});

become:

d3.selectAll("a.tt")
  .call(bootstrap.tooltip()
    .placement("right"));

Plugins

So far we've got:

  1. Tooltips (bootstrap)
  2. Popovers (bootstrap)
  3. Alerts (bootstrap)

Usage

There are a couple of ways to use the plugins. The easiest is to just include d3-bootstrap.js (or the minified version, d3-bootstrap.min.js). If you want individual tools you'll need:

  1. d3-compat.js (or d3-compat.min.js), which provides some baseline jQuery-like compatibility such as "mouseenter" and "mouseleave" event support; and
  2. One or more bootstrap-{tool}.js scripts, e.g. bootstrap-tooltip.js.