jquery Development hyperlink hints effect and picture hint effect

Source: Internet
Author: User

1. Hyperlink hint effect
Hyperlinks come with a hint of the effect, here you define their own cue effect together can be compared. The sample code is as follows:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" ><html><head><meta http-equiv="Content-type" Content="text/html; charset=gb18030 "><title>JQuery Test</title><script type ="text/javascript" src ="Jquery.js" ></script><script type ="Text/javascript">$ (document). Ready ( function(){    varx =Ten;vary = -; $("A.tooltip"). MouseOver ( function(e){     This. MyTitle = This. title; This. title ="";vartooltip ="<div id = ' ToolTip ' >"+ This. mytitle+"</div>"; $("Body"). Append (tooltip);//Append it to the document$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}). Show ("Fast");//set X and Y coordinates, and display}). Mouseout ( function(){         This. title = This. MyTitle; $("#tooltip"). Remove ();//Removal}). MouseMove ( function(e){$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}); });});</script></head><body><p><a href ="#" class ="tooltip" title =" This is my hyperlink tip 1. " >Tip 1.</a></P><p><a href ="#" class ="tooltip" title ="This is my hyperlink tip 2." >Tip 2.</a></P><p><a href ="#" title ="comes with hint 1." >Bring your own hint 1.</a></P><p><a href ="#" title ="comes with hint 2." >Bring your own hint 2.</a></P></body></html>

The results are as follows:

You can see that the custom hints effect works better. And you can set the style more, is the Web page looks more beautiful.

2, Photo tip effect
The sample code is as follows:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" ><html><head><meta http-equiv="Content-type" Content="text/html; charset=gb18030 "><title>JQuery Test</title><script type ="text/javascript" src ="Jquery.js" ></script><script type ="Text/javascript">$ (document). Ready ( function(){    varx =Ten;vary = -; $("A.tooltip"). MouseOver ( function(e){     This. MyTitle = This. title; This. title ="";varImgtitle = This. myTitle?"<br/>"+ This. mytitle:+"";vartooltip ="<div id = ' tooltip ' >+ This. href+"' alt = ' picture preview '/> '+ This. mytitle+"</div>";//This place should pay special attention to add single quotation marks to this.href outside$("Body"). Append (tooltip);//Append it to the document$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}). Show ("Fast");//set X and Y coordinates, and display}). Mouseout ( function(){         This. title = This. MyTitle; $("#tooltip"). Remove ();//Removal}). MouseMove ( function(e){$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}); });});</script></head><body><ul><li><a href ="Http://img0.bdstatic.com/img/image/shouye/sheying0617.jpg" class ="tooltip" title ="Bird"><img src ="Http://img0.bdstatic.com/img/image/shouye/sheying0617.jpg"  Alt ="Bird photo" /></a></li><li><a href ="Http://img0.bdstatic.com/img/image/shouye/bizhi0617.jpg" class ="tooltip" title ="Flowers" ><img src ="Http://img0.bdstatic.com/img/image/shouye/bizhi0617.jpg"  Alt ="Flower picture" /></a></li></ul></body></html>

The results are as follows:

jquery Development hyperlink hints effect and picture hint effect

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.