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: 10, 22 yOffset: 25, 23 tooltipId: "", 24 clickRemove: false, 25 content: "", 26 useElement: "" 27 }; 28 29 var options = $.extend(defaults, options); 30 var content; 31 32 this.each(function() { 33 var title = $(this).attr("title"); 34 $(this).hover(function(e){ 35 content = (options.content != "") ? options.content : title; 36 content = (options.useElement != "") ? $("#" + options.useElement).html() : content; 37 $(this).attr("title",""); 38 if (content != "" && content != undefined){ 39 $("body").append("<div id='"+ options.tooltipId +"'>"+ content +"</div>"); 40 //alert("<div id='"+ options.tooltipId +"'>"+ content +"</div>"); 41 $("#" + options.tooltipId) 42 .css("position","absolute") 43 .css("top",(e.pageY - options.yOffset) + "px") 44 .css("left",(e.pageX + options.xOffset) + "px") 45 .css("display","none") 46 .fadeIn("fast") 47 48 } 49 }, 50 function(){ 51 $("#" + options.tooltipId).remove(); 52 $(this).attr("title",title); 53 }); 54 $(this).mousemove(function(e){ 55 $("#" + options.tooltipId) 56 .css("top",(e.pageY - options.yOffset) + "px") 57 .css("left",(e.pageX + options.xOffset) + "px") 58 }); 59 if(options.clickRemove){ 60 $(this).mousedown(function(e){ 61 $("#" + options.tooltipId).remove(); 62 $(this).attr("title",title); 63 }); 64 } 65 }); 66 67 }; 68 69})(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.