ToolTips Jqeury plug-in simple small hint box effect _jquery

Source: Internet
Author: User
Originally want to use some ready-made plug-ins, find a few are more complex, I want to achieve a small effect, not need too complex, so finally intend to write one!

Implementation effect: The mouse put on top of the text, appear small hint box!

Screenshot of Effect:


Test results: Firefox, IE6/7/8 below through
Description, did not do the parameter customization, may be perfect later, we want to change the display effect, directly adjust the CSS style inside JS! Welcome to the Master advice!
Code

Copy Code code as follows:

(function ($) {
$.fn. Jntooltips=function () {
var div = document.createelement ("div");
Div.style.cssText = ' width:300px; line-height:25px; Border:solid 1px #F3A007; Background-color: #FBE6BD; padding:5px 10px; Font-size:12px;position:absolute '
Div.onclick=function () {$ (div). Remove ();};
$ (this). MouseOver (function (e) {
if (!e) {e=window.event;}
Div.innerhtml= $ (this). attr ("title");
$ (this). attr ("title", "");
var doc = document.documentelement? Document.documentElement:document.body;
div.style.left= (E.clientx+doc.scrollleft + 5) + "px";
div.style.top= (E.clienty+doc.scrolltop + 5) + "px";
Document.body.appendChild (DIV);
}). mouseout (function () {
$ (this). attr ("title", div.innerhtml);
$ (DIV). Remove ();
});
}
}) (JQuery);

How to use:
Copy Code code as follows:

$ (document). Ready (function () {
$ ("a"). Jntooltips ();
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.