views:

84

answers:

5

I'm looking for a javascript/css tooltip that can do the following:

  1. Shows up when you hover over some page element (such as a help icon.)
  2. Repositions itself based on the browser window (for example if it's on the far right of the page, it will show itself to the left of the page element, otherwise it'll show to the right of it. That way it won't go off of the page.)
  3. You can hover over the tooltip and it won't disappear. This way you can select text or click on a hyperlink within the tooltip.

I'm using dojo but their dijit tooltip seems to be very inflexible, as it can only spawn off of another dijit element, most commonly a dijit button. I'd rather not having to reference a whole other javascript framework like jquery or prototype so hopefully someone has a way to do this using just one basic script.

A: 

If you do decide to use jQuery, qTip is a nice jQuery plugin that is very configurable and will probably meet your needs. http://craigsworks.com/projects/qtip/

jayrdub
A: 

Again, assuming that you don't mind using jQuery (it's awesome!!) I played around with a few tooltips and found this one the best: http://flowplayer.org/tools/tooltip/index.html

Extensible with good documentation. Check out the 'position' config option and see if that does what you need.

Good luck!

Hersheezy
+2  A: 

Unfortunately for you, the tooltip style plugins available for Dojo are nowhere near the other frameworks (namely: jQuery). Because of this, you have three options:

Reinvent the wheel. Take what you learned from other tooltip scripts and build your own from scratch. This option takes the longest development time (and in the inevitable maintenance of cross-browser bugs).

Extend an existing plugin. You can take a current tooltip plugin for dojo (or perhaps a library agnostic plugin) and extend its functionality by adding your own scripts to it.

Use jQuery. This has already been said twice by others, but let me say it again. jQuery has a thriving plugin ecosystem, and if development/maintenance times are truly important to you, then jQuery should definitely be considered.

Moses
it might help if you provided one or two actual facts. be constructive.
peller
@peller what exactly did I say that's not factual? The only thing I said that's remotely subjective is that jquery has a bigger plugin community than dojo, and as a result he would have better luck with jquery tooltip plugins, especially considering the fact that the number 1 dojo tooltip plugin doesn't meet his needs.
Moses
Phrases like "nowhere near" aren't just subjective, they're unsupported
peller
A: 

I have been using several jQuery plugins, including jQuery TOOLS, Beauty Tips and Cluetip. I think all three meet your requirements.

If instead of a black box you want to know what's going on, I recommend this tutorial:

http://www.sohtanaka.com/web-design/simple-tooltip-w-jquery-css/

(and take a look at the comments section)

Christophe
A: 

The dijit.Tooltip documentation gives two simple examples, the first attaching a tooltip to simple DOM nodes seems to meet your needs. The second happens to wire up the tooltip to another dijit-based widget (a button). Note that the property connectId takes a dom node reference or string id. Note that dijit may be used either programmatically or using a markup-based declaration.

Different tooltip implementations may have different functionality. Among other things, dijit.Tooltip provides ARIA accessibility for screen readers, keyboard access, bidi enablement, and automatic positioning around a node but within the boundaries of the screen.

peller