jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.



jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.

Demo: https://stephanwagner.me/jBox

Docs: https://stephanwagner.me/jBox/documentation



npm install --save jbox
import jBox from 'jbox';
import 'jbox/dist/jBox.all.css';


<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/StephanWagner/[email protected]/dist/jBox.all.min.js"></script>
<link href="https://cdn.jsdelivr.net/gh/StephanWagner/[email protected]/dist/jBox.all.min.css" rel="stylesheet">


Create a new instance of jBox Tooltip and attach it to elements:

new jBox('Tooltip', {
  attach: '.tooltip'

Now elements with class="tooltip" will open tooltips:

<span class="tooltip" title="My first tooltip">Hover me!</span>
<span class="tooltip" title="My second tooltip">Hover me!</span>

Modal windows

You can set up modal windows the same way as tooltips. But most of times you'd want more variety, like a title or HTML content:

new jBox('Modal', {
  width: 300,
  height: 200,
  attach: '#myModal',
  title: 'My Modal Window',
  content: '<i>Hello there!</i>'
<div id="myModal">Click me to open a modal window!</div>

Confirm windows

Confirm windows are modal windows which requires the user to confirm a click action on an element. Give an element the attribute data-confirm to attach it:

new jBox('Confirm', {
  confirmButton: 'Do it!',
  cancelButton: 'Nope'
<div onclick="alert('Yay! You did it!')" data-confirm="Do you really want to do this?">Click me!</div>
<a href="https://stephanwagner.me/jBox" data-confirm="Do you really want to leave this page?">Click me!</a>


A notice will open automatically and destroy itself after some time:

new jBox('Notice', {
 content: 'Hurray! A notice!'


To create image windows you only need following few lines:

new jBox('Image');
<a href="/image-large.jpg" data-jbox-image="gallery1" title="My image">
  <img src="/image.jpg" alt="">

Learn more

These few examples are very basic. The jBox library is quite powerful and offers a vast variety of options to customize appearance and behavior. Learn more in the documentation: https://stephanwagner.me/jBox/documentation

  • Impossible to display more then one Tooltip

    Impossible to display more then one Tooltip

    Hi there !

    I'm a total newby in jQuery, so please forgive me :o)

    Here's the code someone else put on the site of a client :

    new jBox('Tooltip', {
    attach: '.zlc-infobulle',
    getTitle: 'data-jbox-title',
    content: $('#infobulle-content'),
    closeOnMouseleave: true,
    pointer: 'center:-50',
    maxWidth: 400,
    adjustPosition: true,
    adjustTracker: true

    With this code, each time there is two tooltips, the first one is correctly displayed, and also the title of the second, but the content is always the same, so the second tooltip has the content of the first one.

    Could you please help me with this ? What should I put in content: '' so that both of the tooltips display correctly ?

    Thanks and have a bright shiny day !

    opened by Perlipopette 31
  • Exception occured ,not support on attribute

    Exception occured ,not support on attribute

    sorry my english ,I am Chinese

    Line Number:767 Source code:el.on(trigger + '.jBox-attach-' + this.id, function(ev)

    I use it like this:$("a[title]").jBox("Tooltip");

    opened by yeaicc 12
  • Issue importing with NPM

    Issue importing with NPM

    I have a build script which states: var jBox = require('jBox'); Which my build script (using Browserify) reports Cannot find module 'jBox'...

    The docs on using this with npm seem to skim over the steps in doing so. Can you say if jBox needs to be imported in some specific way with a specific name?

    I can confirm the module is downloaded into node_modules, but still the import fails. Any ideas?


    opened by MartinDM 11
  • i18n problem

    i18n problem

    Hi Stephan,

    great work on jBox! I have a quick question about it. I need the tooltips to show a specific text for each tooltip. The text is placed in a separate json file.

    In the HTML the contents of the language file are called this way:

    There can be different tooltips an a single page. How can I modify this to work?

    Thanks a lot in advance!

    opened by skaman82 11
  • Multiple Open Boxes

    Multiple Open Boxes

    I need to have multiple boxes open at the same time. Easy!

    However, closing the active box also closes all inactive boxes. I noticed that closing a box removes all jbox related classes on . Is this the cause for this behavior?

    Is there any work around for this?

    opened by johnrickman 10
  • Help to add Form to jBox Modal window

    Help to add Form to jBox Modal window

    Thanks for your great jBox. I have tested it to use it to block a drag & drop file upload page until the user selects that they agree to Terms and then can either Continue or Cancel (code below).

    I'd like some guidance to see if I can add a Form where the user must enter a name and email address into two Form fields and have 'confirmButton' be the 'Submit' (submit the form) before he can 'Continue' (to the upload page). I have tried and failed adding the

    code into the content: ' ', area. Any guidance will be appreciated.

    $(document).ready(function() {
      new jBox('Confirm', {
        content: '<h5 style="color:white;">Simply Select <i>Continue</i><br /> To Agree To The</h5> <a href="/terms.html"><h5 style="color:#cccccc;"><u>Upload Terms</u></h5></a>',
        width: 830,
        height: 205,
        cancelButton: '<a href="/index.html"><h5 style="color:white;">Return Home</h5></a>',
    	confirmButton: '<h5 style="color:white;">Continue</h5>',
        confirm: function () {
        cancel: function () {
        window.location.href = "/index.html";

    Much thanks for any help.

    opened by chrisjchrisj 9
  • Scroll moves when open Modal

    Scroll moves when open Modal

    Hi! It's me again... There is an issue that I can't resolve, maybe you can help me... :)

    I have this page with scroll, I'm moving it down for select a row: image

    These icons open a modal popup with the selected row data: image

    When the jBox is opened, the scroll of the main window moves up, at the very top; I'm missing the row I had selected (I mean, I don't know what was the row I opened): image

    Can you help me? Thanks in advance

    opened by OswaldoMM 9
  • el.css is not a function on Notice

    el.css is not a function on Notice

    Hi Stephan