enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

HTML elements without Opentips #103

Closed marcelf closed 10 years ago

marcelf commented 10 years ago

Im trying use opentips without data-op attribute, but doesnt works. Whats wrong?

    <link href="css/opentip.css" rel="stylesheet" type="text/css" />
<script src="jquery/jquery-1.11.0.js"></script>
    <script src="jquery/opentip-jquery.js"></script>
    <script>
    Opentip.styles.tag = {
      ajax: true, // The URL to download will be taken from the href attribute
      showOn: 'click', // this will disable the default <a /> link behaviour.
      target: true, // Takes the <a /> element as target
      tipJoint: "bottom", // So the tooltip floats above the link
      group: "tags" // Ensures that only one tag Opentip is visible
    };
    // Now create an Opentip for each tag element
    $("#tags a.tag").each(function(tagElement) {
      new Opentip(tagElement, { style: "tag" });
    });     
   </script>
    <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>
      etc...
   </div>

Thanks Marcel

enyo commented 10 years ago

Moving your script below the html should work.