Opentip tooltip

by Heena Mahour

HTML

<script src="http://makke.private.prewise.fi/cdnjs/opentip/opentip-jquery.js"></script>
<link rel="stylesheet" href="http://makke.private.prewise.fi/cdnjs/opentip/opentip.css">
 <div id="onstart">
    <h1>
    Heena
    </h1>
  </div>
  
  <br><br>
  
  <br><br>
  <button onclick=" $('#onstart').dsTooltip().opentip()">
    Click me
  </button>

JavaScript

;(function ($, window, document, undefined) {

    var pluginName = "dsTooltip",
        dataKey = "plugin_" + pluginName;

    var Plugin = function (element, options) {
    
        this.element = element;
        
        this.options = {
          
            opentip: {
           
            	title: "",
              escapeTitle: true,
              escapeContent: false,
              className: "Standard",
              stem: true,
              delay: null,
              hideDelay: 0.1,
              fixed: false,
              showOn: "mouseover",
              hideTrigger: "trigger",
              hideTriggers: [],
              hideOn: null,
              removeElementsOnHide: true,
              offset: [0,0],
              containInViewport: true,
              autoOffset: true,
              showEffect: "appear",
              hideEffect: "fade",
              showEffectDuration: 0.3,
              hideEffectDuration: 0.2,
              stemLength: 5,
              stemBase: 8,
              tipJoint: "top left",
              content: "this is a sample content"
            }
        };
        
        this.init(options);
    };

    Plugin.prototype = {
        init: function (options) {
            $.extend(this.options, options);
           
        },
        opentip: function(openTip) {
        debugger;
        var options = this.options.opentip;
        var myOpentip = new Opentip(this.element,options);
            myOpentip.setContent(options.content);
            myOpentip.prepareToShow(); 
        }
    };

    $.fn[pluginName] = function (options) {

        var plugin = this.data(dataKey);

        if (plugin instanceof Plugin) {
     
            if (typeof options !== 'undefined') {
                plugin.init(options);
            }
        } else {
            plugin = new Plugin(this, options);
            this.data(dataKey, plugin);
        }
        
        return plugin;
    };

}(jQuery, window, document));