This page is a demonstration of balloon.js, written by Sheldon McKay.

The balloon.js package is written in object-oriented JavaScript and allows you to add configurable balloon tooltips (AKA popup balloons, bubbles, rollover tooltips etc., etc.) to your website. It was written for scientific web applications, such as GBrowse and WormBase, but is generic and portable to most websites.

The balloons are dynamically sized in both the vertical and horizontal dimensions and the left/right/up/down orientation is calculated automatically based on the position of the cursor. Balloon contents can be provided locally in your own HTML or remotely via AJAX. This package is open source and free to all as long as the copyright notice is retained. See below for demonstrations and documentation.

Please feel free to contact the author for help with installation and usage but don't forget to check out the trouble shooting section for common errors.


Demonstration: mouse over this box click me plainer balloon
fading balloon fading box sticky box
Download: balloons.tar.gz or

The following goes in the <head> element:

 <script type="text/javascript" src="/js/prototype.js"></script>
 <script type="text/javascript" src="/js/balloon.config.js"></script>
 <script type="text/javascript" src="/js/balloon.js"></script>
 <script type="text/javascript" src="/js/box.js"></script>
 <script type="text/javascript">
   // white balloon with default configuration
   // (see
   var balloon    = new Balloon;

   // plain balloon tooltip
   var tooltip  = new Balloon;

   // fading balloon
   var fader = new Balloon;

   // a plainer popup box
   var box         = new Box;

   // a box that fades in/out
   var fadeBox     = new Box;
   fadeBox.bgColor     = 'black';
   fadeBox.fontColor   = 'white';
   fadeBox.borderStyle = 'none';
   fadeBox.delayTime   = 200;
   fadeBox.allowFade   = true;
   fadeBox.fadeIn      = 750;
   fadeBox.fadeOut     = 200;


The HTML for the demo table above:

<table cellpadding=3 style="width:100%">
<th width=10% align=left rowspan=2>Demonstration:</th>
<th width=30% class="tt" style="border:1px solid black"
  onmouseover="balloon.showTooltip(event,'This is a balloon tooltip.\
  It will vanish if you leave this box',0,250)">mouse over this box</th>
<th width=30% class="tt">
<span onmouseover="balloon.showTooltip(event,'Your are hovering, I said click me!')"
      onclick="balloon.showTooltip(event,'Your sticky message goes here.',1)">click me</span>
<th width=30% class="tt"><span onmouseover="tooltip.showTooltip(event,'This is a plain balloon.<br>\
Your message goes here!')">plainer balloon</span></th>
<th  class="tt"><span onmouseover="fader.showTooltip(event,'Your message goes here!')">fading balloon</span></th>
<th  class="tt"><span onmouseover="fadeBox.showTooltip(event,'Your message goes here!')">fading box</span></th>
<th  class="tt"><span onmouseover="box.showTooltip(event,'Your sticky message goes here\
!<br><a href=\'\'>Your link goes here...</span>',1,275)">
sticky box</span></th>
<th align=left>Documentation:</th>
<th colspan=3 align=left class=tt>
<a class=tt href=""
   onmouseover="balloon.showTooltip(event,'Click this link to go to documentation on the GMOD Wiki')">
<th align=left>Download:</th>
<th class=tt colspan=3 align=left>
<a class=tt href=""
   onmouseover="box.showTooltip(event,'Click to download the whole package, with all required scripts, images, etc',0,300)">
<font color="black">
or for windows users...
<a class=tt href=""
      onmouseover="box.showTooltip(event,'Click to download the whole package. Try this if your unzip program \
complains that the tar.gz file is corrupted')">

This is an example of a simple balloon message

 <span onmouseover="balloon.showTooltip(event,'I am a simple message...')">message</span>
This is an example of the same message with a different balloon style
 onmouseover="tooltip.showTooltip(event,'I am a simple message...')">message</span>
This is an example of the same message with a box style
 onmouseover="box.showTooltip(event,'I am a simple message...')">message</span>

Roll over this text for an example of HTML-formatted text loaded from a hidden <div> element.

 <div id="lorem1" style="display:none">
   Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis,
   ligula quis fringilla volutpat, metus mi molestie lorem, <span style="color:red">quis accumsan pede
    turpis nec metus.</span> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.'

Adding a third argument makes the tooltip sticky.
A fourth argument will set the width (Example: 300px sticky balloon)      Try a plain version
Now let's try that with a sticky box.
The height can also be specified with a fifth argument (Example: 250px x 250px sticky balloon)
If the balloon contents are too large for the specified dimensions, you will scrollbars for sticky balloons and clipping for non-sticky balloons.

Here is an example of a tooltip balloon that is populated by an image.

 onmouseover="balloon.showTooltip(event,'<img height=150 src=\'/images/balloons.png\' />')"

This creates a sticky balloon whose contents are from an external website. What's new at the NY Post?
Note: This requires an embedded iframe because it is an external website.

<span onmouseover="balloon.showTooltip(event,'<iframe style=\'width:450;height:290\' 
frameborder=0 src=\'\'></iframe>',1)">
What's new at the NY Post?</span>

Ajax methods are also available.