Move the mouse over the title to display the image

Source: Internet
Author: User

For example, jsp:
<SCRIPT type = text/javascript src = "js/jquery. tooltip. v.1.1.js"> </SCRIPT>
<SCRIPT type = text/javascript src = "js/jquery.tooltip.exe cute. js"> </SCRIPT>
Model: <a href = "# nogo" class = "with-tooltip" title = "$ {air. aircrafttype} </a>
Jquery.tooltip.exe cute. js:
$ (Document). ready (function (){
$ (". With-tooltip"). simpletooltip ();
});
Tooltip. v.1.1.js: www.2cto.com
/**
*
* SimpleTooltip jQuery plugin, by Marius ILIE
* Visit http://dev.mariusilie.net for details
*
**/
(Function ($) {$. fn. simpletooltip = function (){
Return this. each (function (){
Var text = $ (this). attr ("title ");
$ (This). attr ("title ","");
If (text! = Undefined ){
$ (This). hover (function (e ){
Var tipX = e. pageX + 12;
Var tipY = e. pageY + 12;
$ (This). attr ("title ","");
$ ("Body "). append ("<div id = 'simpletooltip 'style = 'position: absolute; z-index: 100; display: none; '> "+ text +" </div> ");
If ($. browser. msie) var tipWidth = $ ("# simpleTooltip"). outerWidth (true)
Else var tipWidth = $ ("# simpleTooltip"). width ()
$ ("# SimpleTooltip"). width (tipWidth );
$ ("# SimpleTooltip" ).css ("left", tipX).css ("top", tipY). fadeIn ("medium ");
}, Function (){
$ ("# SimpleTooltip"). remove ();
$ (This). attr ("title", text );
});
$ (This). mousemove (function (e ){
Var tipX = e. pageX + 12;
Var tipY = e. pageY + 12;
Var tipWidth = $ ("# simpleTooltip"). outerWidth (true );
Var tipHeight = $ ("# simpleTooltip"). outerHeight (true );
If (tipX + tipWidth> $ (window). scrollLeft () + $ (window). width () tipX = e. pageX-tipWidth;
If ($ (window). height () + $ (window). scrollTop () <tipY + tipHeight) tipY = e. pageY-tipHeight;
$ ("# SimpleTooltip" ).css ("left", tipX).css ("top", tipY). fadeIn ("medium ");
});
}
});
}) (JQuery );
Author: gdn_wolf

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.