Tooltips for media buttons. Hat tip: azaozz.

git-svn-id: https://develop.svn.wordpress.org/trunk@7311 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg
2008-03-15 16:53:36 +00:00
parent 1168abf8f3
commit 388c8fa9db
6 changed files with 66 additions and 2 deletions
+33
View File
@@ -10,3 +10,36 @@ addLoadEvent( function() {
jQuery('form').submit( function() { return wpAjax.validateForm( jQuery(this) ); } );
}
});
(function(JQ) {
JQ.fn.tTips = function() {
JQ('body').append('<div id="tTips"><p id="tTips_inside"></p></div>');
var TT = JQ('#tTips');
this.each(function() {
var el = JQ(this), txt;
if ( txt = el.attr('title') ) el.attr('tip', txt).removeAttr('title');
else return;
el.find('img').removeAttr('alt');
el.mouseover(function(e) {
txt = el.attr('tip'), o = el.offset();;
clearTimeout(TT.sD);
TT.find('p').html(txt);
TT.css({'top': o.top - 43, 'left': o.left - 5});
TT.sD = setTimeout(function(){TT.fadeIn(150);}, 100);
});
el.mouseout(function() {
clearTimeout(TT.sD);
TT.css({display : 'none'});
})
});
}
}(jQuery));
jQuery(function(){jQuery('#media-buttons a').tTips();});