| 358 | | $.fn.tTips = function() { |
| 359 | | |
| 360 | | $('body').append('<div id="tTips"><p id="tTips_inside"></p></div>'); |
| 361 | | var TT = $('#tTips'); |
| 362 | | |
| 363 | | this.each(function() { |
| 364 | | var el = $(this), txt; |
| 365 | | |
| 366 | | if ( txt = el.attr('title') ) el.attr('tip', txt).removeAttr('title'); |
| 367 | | else return; |
| 368 | | el.find('img').removeAttr('alt'); |
| 369 | | |
| 370 | | el.mouseover(function(e) { |
| 371 | | txt = el.attr('tip'), o = el.offset(); |
| 372 | | |
| 373 | | clearTimeout(TT.sD); |
| 374 | | TT.find('p').html(txt); |
| 375 | | |
| 376 | | TT.css({'top': o.top - 43, 'left': o.left - 5}); |
| 377 | | TT.sD = setTimeout(function(){TT.fadeIn(150);}, 100); |
| 378 | | }); |
| 379 | | |
| 380 | | el.mouseout(function() { |
| 381 | | clearTimeout(TT.sD); |
| 382 | | TT.css({display : 'none'}); |
| 383 | | }) |
| 384 | | }); |
| | 356 | _old_attr = $.attr; |
| | 357 | $.attr = function(elem, name, value) { |
| | 358 | if ( typeof value === 'string' ) |
| | 359 | value = $('<span>'+value+'</span>').html(); |
| | 360 | return _old_attr(elem, name, value); |