<!DOCTYPE html>
<html>
<head>
<title>jQuery Tools standalone demo</title>
<!-- include the Tools -->
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(
function($){
var sweetTitles = { x : 10,
y : 20,
tipElements : "a,span,img,div",
noTitle : true,
init : function() {
var noTitle = this.noTitle;
$(this.tipElements).each(function(){
$(this).mouseover(
function(e){
if(noTitle){
isTitle = true;
}else{
isTitle = $.trim(this.title) != '';
}
if(isTitle){
this.myTitle = this.title;
this.title = "";
var tooltip = "<div class='tooltip'><div class='tipsy-arrow tipsy-arrow-n'></div><div class='tipsy-inner'>"+'test'+"</div></div>";
$('body').append(tooltip);
$('.tooltip').css({ "top" :( e.pageY+20)+"px", "left" :( e.pageX-20)+"px" }).show('slow');
}
})
.mouseout(
function(){
if(this.myTitle != null){
this.title = this.myTitle;
$('.tooltip').remove();
}
})
.mousemove(
function(e){
$('.tooltip').css({ "top" :( e.pageY+20)+"px", "left" :( e.pageX-20)+"px" });
});
});
}
};
$(function(){
$("button").click(function(){ $("#username").val("jQuery 仍在运行!");});
sweetTitles.init();
});
});
</script>
<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;
}
/* http://www.quirksmode.org/css/forms.html */
#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;
}
/* simple css-based tooltip */
.tooltip1 {
color:green;
text-align:left;
font-size:50px;
/* outline radius for mozilla/firefox only */
-moz-box-shadow:0 0 10px #000;
-webkit-box-shadow:0 0 10px #000;
}
.tooltip {font-size: 15px;position: absolute;padding: 5px;z-index: 100000;opacity: 0.8; width:200px; border:1px solid #ccc; display:none; background-color:#555;}
.tipsy-arrow1 {position: absolute;width: 0;height: 0;line-height: 0;border: 6px dashed #000;top: 0px;left: 20%;margin-left: -5px;border-bottom-style: solid;border-top: none;border-left-color: transparent;border-right-color: transparent;}
.tipsy-arrow-n1 {border-bottom-color: #000;}
.tipsy-arrow {position: absolute;width: 0;height: 0;line-height: 0;
border: 6px solid #000;top: 0px;left: 20%;margin-left: -5px;
border-left-color: transparent;
border-right-color: transparent;
border-top-color: green;
border-bottom-color: yellow;
border-top: none;
}
.tipsy-inner {background-color: #000;color: #FFF;max-width: 200px;padding: 5px 8px 4px 8px;text-align: center;border-radius: 3px;}
</style>
</head>
<body><form id="myform" action="#">
<h3>Registration Form</h3>
<div id="inputs">
<!-- username -->
<label for="username">Username</label>
<input id="username" title="Must be at least 8 characters."/>
<br />
<!-- password -->
<label for="password">Password</label>
<input id="password" type="password" title="Make it hard to guess." />
<br />
<!-- email -->
<label for="email">Email</label>
<input id="email" title="We won't send you any marketing material." />
<br />
<!-- message -->
<label for="body">Message</label>
<textarea id="body" title="What's on your mind?"></textarea>
<br />
<!-- message -->
<label for="where">Select one</label>
<select id="where" 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" id="check" title="Required to proceed" />
</label>
<a href="www.baidu.com" >tesbt</a>
<button type="button" title="This button won't do anything">
Proceed
</button>
</form>
<script type="text/javascript">
</script>
</body>
</html>
tooltip
最新推荐文章于 2024-07-26 20:46:33 发布