1/* 2 * Easy Tooltip 1.0 - jQuery plugin 3 * written by Alen Grakalic 4 * http://cssglobe.com/post/4380/easy-tooltip--jquery-plugin 5 * 6 * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com) 7 * Dual licensed under the MIT (MIT-LICENSE.txt) 8 * and GPL (GPL-LICENSE.txt) licenses. 9 * 10 * Built for jQuery library 11 * http://jquery.com 12 * 13 */ 14 15(function($) { 16 17 $.fn.easyTooltip = function(options) { 18 19 // default configuration properties 20 var defaults = { 21 xOffset: 0, 22 yOffset: 5, 23 tooltipId: "easyTooltip", 24 clickRemove: false, 25 content: "", 26 useElement: "", 27 position: "right" 28 }; 29 30 options = $.extend(defaults, options); 31 var content; 32 33 this.each(function() { 34 var title = $(this).attr("data-tooltip"); 35 $(this).hover(function(e) { 36 content = (options.content !== "") ? options.content : title; 37 content = (options.useElement !== "") && $(options.useElement).length ? $(options.useElement).html() : content; 38 if (title) { 39 $(this).attr("data-tooltip", ""); 40 } 41 if (typeof content !== "undefined" && content) { 42 $("body").append("<div id='" + options.tooltipId + "' class='tooltip topArrow'>" + content + "</div>"); 43 $("#" + options.tooltipId) 44 .css("position", "absolute") 45 .css("top", ($(this).offset().top + $(this).outerHeight() + options.yOffset) + "px") 46 .css("left", ($(this).offset().left + options.xOffset) + "px") 47 .css("display", "none") 48 .css("z-index", "10000") 49 .fadeIn("fast"); 50 } 51 }, 52 function() { 53 $("#" + options.tooltipId).remove(); 54 if (title) { 55 $(this).attr("data-tooltip", title); 56 } 57 }); 58 if (options.clickRemove) { 59 $(this).mousedown(function(e) { 60 $("#" + options.tooltipId).remove(); 61 if (title) { 62 $(this).attr("data-tooltip", title); 63 } 64 }); 65 } 66 }); 67 }; 68})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.