balloons.html 5.15 KB
<html>
<head>
 <title>Balloon tooltip demonstration</title>
 <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/yahoo-dom-event.js"></script> 
 <script> var balloon = new Balloon;</script>
 <style>
  a.tt { 
    background-color:lightsteelblue;
    text-decoration:none;
  }
  .hidden {
    display:none;
  }
  pre {
    background-color:gainsboro;
    padding:10px;
    margin-left:20px;
    margin-right:20px;
    font-family:courier;
    font-size:90%;
  }
  b.y { background-color:yellow }
 </style>
</head>
<body>
<h1>Balloon tooltip demonstration</h1>
<div style="border:1px solid red;text-align:center;margin-bottom:5px">
Javascript code: <a href="/js/balloon.js" target="_new"
onmouseover="balloon.showTooltip(event,'Get the javascript code!')">
balloon.js</a>
&nbsp;&nbsp;|&nbsp;&nbsp;
Documentation: <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons"
onmouseover="balloon.showTooltip(event,'Documentation for installation and usage')"; target="_new">Wiki</a>
</div>
<div style="border:1px solid blue;background:azure;padding:10px;font-family:arial, sans-serif">
<a href="http://www.gmod.org/wiki/index.php/Popup_Balloons" target="_blank"
   onmouseover="balloon.showTooltip(event,'Want to do this with your website? Click for documentation!')">
<img src="/images/sample_balloon.png" style="float:right;border:2px solid black" />
</a>
This page is a demonstration of balloon.js, written by <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons">Sheldon McKay</a>
<ul>
<li>balloon.js is an object-oriented JavaScript class for highly configurable balloon tooltips (AKA popup balloons, bubbles, etc)</li>
<li>the balloon.js package is completely free and open source, so help yourself!</li>
<li>See <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons">www.gmod.org/wiki/index.php/Popup_Balloons</a> for complete documentation</li>
<li>Please feel free to <a href="mailto:mckays@cshl.edu">Contact the Author<a> for help with installation and usage</li>
</ul>
</div>

<p>
Page header with required components
</p>
<pre>
&lt;head&gt;
 &lt;title&gt;balloon tooltip demonstration&lt;/title&gt;
 &lt;script type="text/javascript" src="/js/balloon.config.js"&gt;&lt;/script&gt;
 &lt;script type="text/javascript" src="/js/balloon.js"&gt;&lt;/script&gt;
 &lt;script type="text/javascript" src="/js/yahoo-dom-event.js"&gt;&lt;/script&gt;
 &lt;script type="text/javascript"&gt; var balloon = new balloon;&lt;/script&gt;
&lt;/head&gt; 
</pre>

<div id="lorem1" class="hidden">
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.'
</div>

<div id="lorem2" class="hidden">
<a href="http://www.lipsum.com" target="_new" style="color:blue">What is <i>Lorem ipsum...</i>?</a>
Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis
, ligula quis fringilla volutpat, metus mi molestie lorem, quis accumsan pede
turpis nec metus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</div>

<p>
This is an example of a simple balloon <a href="javascript:void(0)" class=tt 
onmouseover="balloon.showTooltip(event,'I am a simple message...')">message</a>

<pre>
 &lt;a href="javascript:void(0)" onmouseover="balloon.showTooltip(event,'I am a simple message...')"&gt;message&lt;/a&gt;
</pre>
</p>

<p>
Roll over <a href="javascript:void(0)" class=tt onmouseover="balloon.showTooltip(event,'load:lorem1')">
this text</a> for an example of HTML-formatted text loaded from a hidden &lt;div&gt; element.
<pre>
 onmouseover="balloon.showTooltip(event,<b class=y>'load:lorem1'</b>)"
</pre>

<span id=sticky>
Adding a third argument makes the tooltip <a href="javascript:void(0)" class=tt
onmouseover="balloon.showTooltip(event,'load:lorem2',1)">sticky</a>.</span>

<pre>
 onmouseover="balloon.showTooltip(event,'load:lorem2',<b class=y>1</b>)"
</pre>

A fourth argument will set the width (Example:<a href="javascript:void(0)" class=tt 
onmouseover="balloon.showTooltip(event,'load:lorem2',1,300)">
300px sticky balloon</a>)
<pre>
 onmouseover="balloon.showTooltip(event,'load:lorem2',1,<b class=y>300</b>)"
</pre>
</p>

<p>
Here is an example of a tooltip balloon that is populated by an
<a href="javascript:void(0)" class=tt
onmouseover="balloon.showTooltip(event,'<img height=150 src=/images/balloons.png>')">
image</a>.
<pre>
 onmouseover="balloon.showTooltip(event,'&lt;img src=/images/balloons.png&gt;')"
</pre>
</p>

<p>
This link will create a sticky balloon whose contents are from a remote URL.
<a href="javascript:void(0)" class=tt 
onmouseover="balloon.showTooltip(event,'<iframe style=\'width:270;height:300\' frameborder=0 src=\'http://www.nypost.com/avantgo/avantnews/avantnews.htm\'></iframe>',1,300)">
What's new?</a><br>This requires an embedded iframe.
<pre>
 onmouseover="balloon.showTooltip(event,'\
 &lt;iframe style=\'width:270;height:300;border:0\' \
 src=\'http://www.nypost.com/avantgo/avantnews/avantnews.htm\'&gt;&lt;/iframe&gt;',1,300)"
</pre>
</p>
</body>