<!DOCTYPE html> 
<html> 
<head> 
<title>jQuery Tools standalone demo</title> 
<!-- include the Tools --> 
<script src="https://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script> 
<link type="text/css" 
href="./tooltip-generic.css"/> 
<style> 
#myform { 
border:1px outset #ccc; 
background:#fff repeat-x; 
padding:20px; 
margin:20px auto; 
width:350px; 
font-size:12px; 
-moz-border-radius:4px; 
} 
#myform h3 { 
text-align:center; 
margin:0 0 10px 0; 
} 
/*  */ 
#inputs label, #inputs input, #inputs textarea, #inputs select { 
display: block; 
width: 150px; 
float: left; 
margin-bottom: 20px; 
} 
#inputs label { 
text-align: right; 
width: 75px; 
padding-right: 20px; 
} 
#inputs br { 
clear: left; 
} 
</style> 
</head> 
<body><form action="#"> 
<h3>Registration Form</h3> 
<div> 
<!-- username --> 
<label for="username">Username</label> 
<input title="Must be at least 8 characters."/> 
<br /> 
<!-- password --> 
<label for="password">Password</label> 
<input type="password" title="Make it hard to guess." /> 
<br /> 
<!-- email --> 
<label for="email">Email</label> 
<input title="We won't send you any marketing material." /> 
<br /> 
<!-- message --> 
<label for="body">Message</label> 
<textarea title="What's on your mind?"></textarea> 
<br /> 
<!-- message --> 
<label for="where">Select one</label> 
<select title="Select one of these options"> 
<option>-- first option --</option> 
<option>-- second option --</option> 
<option>-- third option --</option> 
</select> 
<br /> 
</div> 
<!-- email --> 
<label> 
I accept the terms and conditions 
<input type="checkbox" title="Required to proceed" /> 
</label> 
<p> 
<button type="button" title="This button won't do anything"> 
Proceed 
</button> 
</p> 
</form> 
<!-- javascript coding --> 
<script> 
// execute your scripts when the DOM is ready. this is a good habit 
$(function() { 
// select all desired input fields and attach tooltips to them 
$("#myform :input").tooltip({ 
// place tooltip on the right edge 
position: "center right", 
// a little tweaking of the position 
offset: [-2, 10], 
// use the built-in fadeIn/fadeOut effect 
effect: "fade", 
// custom opacity setting 
opacity: 0.7 
}); 
}); 
</script> 
</body> 
</html> 
jQuery Tools tooltip使用说明
内容版权声明:除非注明,否则皆为本站原创文章。
