ToolTips jqeury plug-in: simple and small prompt box Effect

Source: Internet
Author: User

I originally wanted to use some ready-made Plug-ins. I found a few plug-ins that were complicated. I wanted to implement a small effect and it didn't need to be too complicated. So I finally planned to write one myself!

Effect: place the cursor over the text and a prompt box appears!

Effect:


Test results: Firefox, IE6/7/8
Note: No parameter customization is made, and it may be improved in the future. If you want to change the display effect, you can directly adjust the CSS style in Js! Thank you for your advice!
Code

CopyCode The Code is as follows: (function ($ ){
$. FN. jntooltips = function (){
VaR DIV = Document. createelement ("Div ");
Div.style.css text = '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.doc umentelement? Document.doc umentelement: 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 );

Usage:Copy codeThe Code is 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.