§ TinyHint (jQuery)
TinyHint
(function($) { $.fn.tinyHint = function (options) { var o = $.extend({ topOffset: null, leftOffset: 20, fadeSpeed: '', hintClass: '', hideDelay: null, theHint: null }, options); var hideTimer; var hinter; var theHint = o.theHint || $('<div></div>'); theHint = $(theHint); theHint.css({'display': 'none', 'position': 'absolute', 'z-index': 9999}).addClass(o.hintClass).appendTo('body'); o.topOffset = o.topOffset || -theHint.html(' ').outerHeight(); return this.each(function() { var it = $(this); if(it.data('hint') === undefined) { if(this.title && this.title.length) { it.data('hint', this.title); } } if(it.data('hint') && it.data('hint').length) { it.removeAttr('title'); } else { return; } it.hover(startHint, stopHint); }); function positionHint(e) { theHint.css({top:0,left:0}).position({ my:'left+' + o.leftOffset + ' top+' + o.topOffset, of: e, collision:'flipfit' }) } function startHint(e) { e.stopPropagation(); clearTimeout(hideTimer); hinter = $(this); theHint.stop(true).hide().html(hinter.data('hint')).fadeIn(o.fadeSpeed); positionHint(e); hinter.on('mousemove', null, positionHint); hinter.on('blur', null, stopHint); if(o.hideDelay) { hideTimer = setTimeout(stopHint, o.hideDelay); } } function stopHint() { clearTimeout(hideTimer); hinter = $(this); theHint.stop(true).fadeOut(o.fadeSpeed); hinter.off('mousemove', null, positionHint); hinter.off('blur', null, stopHint); } }; }(jQuery)); //$.fn.tinyHint
$(function() { $('[data-edittitle]').each(function(){ this.title = this.title || $(this).data('edittitle'); }); $('td').each(function(){ if(isEllipsisActive(this)) { this.title = this.textContent; } }) $('[title]').tinyHint({hintClass: 'ui-tooltip ui-widget ui-corner-all ui-widget-content', hideDelay: 3000}); })
last edited on January 11th, 2016 at 3:44 PM
Categories
Comments
- Walid on "Adventures with Ubuntu 9.10 on G4 Yikes!" - I am in the same process as you. Although I still dual-boot to Windows for my ganimg leisure. My first contact with Ubuntu was way…
- Slashback on "Simpler adding & removing element classnames" - Actually, the addClassName function does what you want, pretty much the same way you suggest.
- angie on "Simpler adding & removing element classnames" - And what if I want to add a class, but keeping the csseals the element already has?I mean, I have an element with a class, let's name…
- backlinks on "Adjust iframe height to contents" - Definitely helped me.
- Slashback on "Simpler validate form fields are filled in (no additional class names)" - You are welcome!