Custom Popover

by rtcherry

HTML

<a href="#" title="Oh My!">Link</a>

CSS

@charset"UTF-8";
 html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size:100%;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
 article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
    content:'';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
/* End HTML5 Reset */
 html {
    -webkit-font-smoothing: antialiased;
}
.rc-tooltip-default {
    border-radius: 5px;
    border: 2px solid #000;
    background: #4c4c4c;
    color: #fff;
}
.rc-tooltip-default .rc-tooltip-content {
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 16px;
    padding: 8px 10px;
    overflow: hidden;
}
.rc-tooltip-icon {
    cursor: help;
    margin-left: 4px;
}
.rc-tooltip-base {
    padding: 0;
    font-size: 0;
    line-height: 0;
    position: absolute;
    z-index: 9999999;
    pointer-events: none;
    width: auto;
    overflow: visible;
}
.rc-tooltip-base .rc-tooltip-content {
    overflow: hidden;
}
.rc-tooltip-arrow {
    display: block;
    text-align: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}
.rc-tooltip-arrow span, .rc-tooltip-arrow-border {
    display: block;
    width: 0;
    height: 0;
    position:...

JavaScript

(function ($, window, document, undefined) {
    var pluginName = 'rc_tooltip',
    defaults = {},
//        Plugin = function(element, options) {
//		this.element = element;
//		this.options = $.extend( {}, defaults, options );
//		this.init();
//        },
    methods = {
        init: function(options) {
            return this.each(function() {
                var $this = $(this);
            });
        },
        destroy: function() {
            return this.each(function() {
                $(window).unbind('.' + pluginName);
            })
        },
    };

    $.fn[pluginName] = function(options) {
        if (typeof options === 'string' && methods[options]) {
            return methods[options].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof options === 'object' || !options) {
//			return this.each(function() {
//                if (!$.data(this, pluginName)) {
//				    $.data(this, pluginName, new Plugin(this, options));
//                }
//			});
            return methods.init.apply(this, arguments);
        } else {
            $.error('Method ' + method + ' does not exist.');
        }
    }
})(jQuery, window, document);

$('a').rc_tooltip();