tooltip

<!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> 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值