opentip
opentip copied to clipboard
Problem with code snippet in docs section.
I would like to create the tool tips as described in the best practice section of the docs page. However, the code doesn't work in my environment, even though I can programmatically set some tool tips using the same artifacts. Here is the code that I created based on the documentation:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <title>Tip</title> <script src="opentip-prototype.min.js" type="text/javascript"></script> <script src="opentip-native.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery-1.9.1.js"> </script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"> </script> <link href="opentip.css" rel="stylesheet" type="text/css"/>
<style type="text/css"> Opentip.styles.tag = { ajax: true, showOn: 'click', target: true, tipJoint: "bottom", group: "tags" }; </style> <body> <div id="tags"> <a href="/tag-info/1" class="tag">Tag 1</a> <a href="/tag-info/2" class="tag">Tag 2</a> <a href="/tag-info/3" class="tag">Tag 3</a> </div> <script type='text/javascript'> $("#tags a.tag").each(function(tagElement) { new Opentip(tagElement, { style: "tag" }); }); </script> </body> </html>
I would like it if an opentip user could try this out and tell me what is missing. It looks like the Opentip calls never returns. Not sure if this is incompatibility with my browser or the jQuery lib that I am using.
In general, I think it would be a good idea to have self-contained examples in the documentation that one could reference to see how things are done.
Martin
There is an error in the documentation with a missing parameter of the each function. It should be
// Now create an Opentip for each tag element $("#tags a.tag").each(function(idx, tagElement) { new Opentip(tagElement, { style: "tag" }); });
@leszekhanusz is correct