CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: JavaScript

Form Tip - jQuery Tooltip plugin experiment :o)

240 Views
Copy Code Show/Hide Line Numbers
 
jQuery.fn.formtip = function() {
    return this.each(function(i, el) {
        var item = jQuery(el);
        var title = item.attr("title");
        
        if (title == undefined) {
            return true;
        } else {
            item.hover(
                function(over) {
                    //alert("over");
                    var top = item.offset().top;
                    var left = item.offset().left;
                    var width = item.width() + 11;
                    
                    jQuery("body").after("<div class='jformtip-tooltip' style='top: " + top + "px ; left: " + (left + width).toString() + "px ; position: absolute'>" + title + "</div>")
                }, 
                function(out) {
                    //alert("out");
                    jQuery(".jformtip-tooltip").remove();
                }
            );
        }
    });
};
by jwwishart
  January 18, 2010 @ 4:07pm
Tags:
Description:
my first experimental jquery plugin

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate