Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A lightweight jQuery based balloon tip library
JavaScript Ruby
tree: 6d5ecf90e8

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demo
lib
releases
src
.gitignore
CHANGELOG.rdoc
MIT-LICENSE
README.textile
Rakefile
VERSION

README.textile

RaccoonTip

A lightweight jQuery based balloon tip library

Introduction

RaccoonTip is a small Javascript library which lets you display HTML, DOM elements or text in a balloon tip with ease. It uses jQuery (http://jquery.com) and is tested in IE6+, Firefox 3+, Safari 3+ and Chrome5+. RaccoonTip does NOT require images and is rendered with CSS3.

Installation

When including jQuery yourself

Just include RaccoonTip after you have included jQuery:

  <script src="path/to/jquery.js"      type="text/javascript"></script>
  <script src="path/to/raccoon_tip.js" type="text/javascript"></script>

Note: include raccoon_tip.min.js for the minified RaccoonTip library

When letting RaccoonTip include jQuery automatically

Make sure you put the jquery directory in the same directory as the RaccoonTip library:

  |-raccoon_tip.js
  |~jquery
    `-core.js

Just include RaccoonTip:

  <script src="path/to/raccoon_tip.js" type="text/javascript"></script>

Note: include raccoon_tip.min.js for the minified RaccoonTip library

Usage

The RaccoonTip module provides you the following three functions:

  • display – The core function for displaying the RaccoonTip
  • register – Instruct RaccoonTip to call RaccoonTip.display when a certain event is triggered on certain elements (at default the click event)
  • close – This function closes the RaccoonTip of course

Display

As already mentioned, this is the core function for displaying RaccoonTip. This function accepts the following arguments:

  • target – The element which RaccoonTip points to
  • content – The content which will be displayed within RaccoonTip: this can be either null (for dynamic content), HTML, DOM elements or text
  • options – A simple hash which customizes RaccoonTip

Available options

  • durationdefault: "fast"
    This influences the speed with which RaccoonTip will be displayed (see also http://api.jquery.com/show)
  • positiondefault: "bottom_right"
    The default position with which RaccoonTip will attempt to display itself (it searches for an alternative when displayed outside the window viewport)
  • beforeShowdefault: function() {}
    A callback function called before showing RaccoonTip (handy for altering RaccoonTip’s content dynamically)
  • canHidedefault: function() { return true; }
    A function which will only close RaccoonTip when the function returns a true value
  • afterHidedefault: function() {}
    A callback function called after hiding RaccoonTip

A simple example

  <script>
    RaccoonTip.display("#page_menu a.login", "#login_menu", {duration: "slow"});
  </script>

Register

You can use RaccoonTip.register to instruct RaccoonTip to display itself when a certain event on certain elements are triggered. It accepts the same arguments as RaccoonTip.display.

Available options

The options available are the options listed in Display along with:

  • eventdefault: "click"
    The event that triggers the call to RaccoonTip.display()

A simple example

  <script>
    RaccoonTip.register(
      "a.tip", null,
      {
        event: "hover",
        beforeShow: function(content, options) {
          $(this).html(randomText());
        }
      }
    );
  </script>

Close

You can close the RaccoonTip just by clicking outside it. But you can also close it by calling the close function:

  <a href="#" onclick="RaccoonTip.close(); return false">Close</a>

or

  <script>
    RaccoonTip.close();
  </script>

It’s easy as 1-2-3!

RaccoonTip in action

Please take a look at http://archan937.github.com/raccoon_tip for a live demo.

Contact me

For support, remarks and requests please mail me at paul.engel@holder.nl.

Credit

This Javascript library depends on the jQuery library:

http://jquery.com

License

Copyright © 2011 Paul Engel, released under the MIT license

http://holder.nlhttp://github.com/archan937http://codehero.eshttp://gettopup.comhttp://twitter.com/archan937paul.engel@holder.nl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.