<link href="css/manhua_hoverTips.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://www.jq-school.com/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/manhua_hoverTips.js"></script>
<script type="text/javascript">
$(function () {
$("p").manhua_hoverTips(); //使用默认参数,所以不用调用最简洁(下面显示)
$("#btn").manhua_hoverTips({ position: "l" }); //改变了显示的位置参数(右边显示)
$("#tr").manhua_hoverTips({ position: "r" }); //改变了显示的位置参数(左边显示)
$("#tb").manhua_hoverTips({ position: "b" }); //改变了显示的位置参数(下面显示)
});
</script> <body>
<center>
<form id="form1" runat="server">
<div>
<p tips="哈哈 是我。。。。。">afdsafdsfasd</p>
<input id="btn" type="button" tips="我怎么了,怎么会???" value="button" />
<br />
<select id="tr" tips="是我。。。。。"><option></option>
</select>
<br />
<input id="tb" tips="你要说什么......." type="radio" />
</div>
</form>
</center>
</body>
body {
background: #f7f7f7;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.docBubble {position:absolute;max-width:240px; text-align:left;text-align:left;z-index:; display:none;}
.docBubble a{ margin-left:;}
.docBubble .icon{ background:none;}
.docBubble .title a {text-decoration: none;}
.docBubble .tl,.docBubble .tr,.docBubble .bl,.docBubble .inner,.docBubble .triangle-t,.docBubble .triangle-b,.docBubble .close{ background-image:url(../images/manhua_bubbletips.png);_background-image:url(../images/manhua_bubbletips_ie6.png); }
.docBubble .tl{ float:left; background-position:-20px ; }
.docBubble .tr{ position:absolute;right:-12px; top:;width:12px; height:12px; background-position:% ; }
.docBubble .bl{ position:absolute;left:; bottom:-12px; width:12px; height:12px; background-position:-20px %; }
.docBubble .inner{ position: relative;left:12px; width:220px; margin:12px -12px ; max-width:220px; background-position:% %; padding: 12px 12px 2px; _padding-bottom:12px; }
.docBubble .triangle-t{ position:absolute; z-index:; top:-7px; width:15px; height:8px; overflow:hidden; }
.docBubble .triangle-b{ position:absolute; bottom:-18px; z-index:; width:15px; height:11px; overflow:hidden; background-position: -10px; }
.docBubble .triangle-l{ position:absolute; left:-10px; z-index:; top:15px; width:15px; height:18px; overflow:hidden; background:url(../images/manhua_bubbletips_l.png) no-repeat;_background-image:url(../images/manhua_bubbletips_l_ie6.png) no-repeat; }
.docBubble .triangle-r{ position:absolute; right:-19px; z-index:; top:15px; width:15px; height:18px; overflow:hidden; background:url(../images/manhua_bubbletips_r.png) no-repeat;_background-image:url(../images/manhua_bubbletips_r_ie6.png) no-repeat; }
.docBubble .triangle-t,.docBubble .triangle-b{ right:20px;}
.docBubble .close{ position:absolute; z-index:; top:10px; right:2px; width:9px; height:9px; text-indent:-99em; overflow:hidden; background-position: -25px; cursor:pointer;}
.docBubble .inner .icon{ float:left; padding: 2px ;}
.docBubble .inner .icon img{ margin-right:10px; }
.docBubble .inner .cont{ overflow:hidden; zoom:; line-height:20px;}
.docBubble .inner .title{ margin: 2px ; font-size:12px;font-weight:bold;}
.docBubble .inner .lk-btn{ text-align:right;}

css(manhua_hoverTips.css)

/***
* 漫画原创鼠标悬浮气泡提示Jquery插件
* 编写时间:2012年11月14号
* version:manhua_hoverTips.js
***/
$(function() {
$.fn.manhua_hoverTips = function(options) {
var defaults = {
position : "t", //箭头指向上(t)、箭头指向下(b)、箭头指向左(l)、箭头指向右(r)
value : //小箭头偏离左边和上边的位置 };
var options = $.extend(defaults,options); var bid = parseInt(Math.random()*);
var $this = $(this);
$("body").prepend('<div class="docBubble" id="btip'+bid+'"><i class="triangle-'+options.position+'"></i><div class="tl"><div class="inner"><div class="cont"></div></div></div><div class="tr"></div><div class="bl"></div></div>');
var $btip = $("#btip"+bid);
var $btipClose = $("#btipc"+bid);
var offset,h ,w ;
var timer;
$this.die().live("mousemove",function(){
clearInterval(timer);
offset = $(this).offset();
h = $(this).height();
w = $(this).width();
$(".cont").html($(this).attr("tips")); switch(options.position){
case "t" ://当它是上面的时候
$(".triangle-t").css('left',options.value);
$btip.css({ "left":offset.left , "top":offset.top+h+ }).show();
break;
case "b" ://当它是下面的时候
$(".triangle-b").css('left',options.value);
$btip.css({ "left":offset.left , "top":offset.top-h--$btip.height() }).show();
break;
case "l" ://当它是左边的时候
$(".triangle-l").css('top',options.value);
$btip.css({ "left":offset.left+w+ , "top":offset.top+h/--options.value }).show();
break;
case "r" ://当它是右边的时候
$(".triangle-r").css('top',options.value);
$btip.css({ "left":offset.left--$btip.width() , "top":offset.top+h/--options.value }).show();
break;
} });
$this.live("mouseout",function(){
timer = setInterval(function (){
$btip.hide();
}, );
}); $btip.live("mousemove",function(){
clearInterval(window.timer);
$btip.show();
});
$btip.live("mouseout",function(){
$btip.hide();
});
$btipClose.live("click",function(e){
$btip.hide();
});
}
});

manhua_hoverTips.js

jquery提示气泡的更多相关文章

  1. jquery $提示缺少对象$提示缺少对象

    jquery $提示缺少对象 项目中存在不同版本的jquery,有1.4也有1.2, 之前运行项目不会报错 " $提示缺少对象 ",但是我的IE9重置之后就报错,从网上找了一大堆, ...

  2. jQuery提示组件toastr(取代alert)

    给大家推荐一款jquery提示插件:toastr 它是一个可以取代alert的提示信息框,它在PC,移动设备上都有不错的UI效果. 具体使用方法如下: 1.首先在网页头站调用他需要的js和css文件. ...

  3. jquery提示sucess

    这是学习笔记. 今天做东西的时候,想把体验做好,于是打算再ajax success字段中添加函数实现提示sucess. 用了jquery的fadeIn 跟fadeOut,再fadeIn的callbac ...

  4. jquery 提示语淡入效果

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. idea开启jquery提示及如何找到学习目标

    idea开启jquery提示 根据这些library就知道该学习哪些技术了

  6. Eclipse通过Spket增加JQuery提示的方法

    Eclipse通过Spket增加JQuery提示的方法 1.增加在线更新源:Help->Install New Software...->Add...->Name: "Sp ...

  7. Android 红色小圆球提示气泡 BadgeView

    今天给大家分享两个实用有简单的一个小圆球提示气泡: BadgeView 参考地址: https://github.com/qstumn/BadgeView;       个人地址:http://git ...

  8. jquery提示消息,简单通用

    jquery提示消息.简单通用 function showTips(txt,time,status) { var htmlCon = ''; if(txt != ''){ if(status != 0 ...

  9. DSAPI多功能组件编程应用-DS提示气泡

    首先下载DSAPI.dll.并在项目中引用. 该功能包括在DSAPI1.0.1.1及更高版本号,DLL请到本人资源里查找. Private Sub Button1_Click(sender As Ob ...

随机推荐

  1. PHP学习之环境搭建

    计算机环境 win7  64位 搭建  apache-httpd-2.2-win64  +  php-5.3.6-Win32-VC9-x64  +MySQL_5.5.13_winx64开发环境 参考: ...

  2. ThinkPHP图片上传

    ThinkPHP是国内比较流行的轻量级的PHP框架,它在国内流行的一个最主要的因素在于它的说明文档非常健全完善,以及它源码内的注释都是中文的,方便于英语能力较差的程序员学习. 图片上传在网站里是很常用 ...

  3. 数据库中join的用法(on、left。right)

    Table A aid   adate 1      a1 2      a2 3      a3 TableB bid bdate 1    b1 2   b2 4    b4 两个表a,b相连接, ...

  4. EXTJS 4.2 资料 控件之Grid 添加行,编辑行,删除行

    //SiteVariableConfigValue类,创立一个模型类 Ext.define("SiteVariableConfigValue", { extend: "E ...

  5. BZOJ 1588 营业额统计 Splay

    主要操作为Splay中插入节点,查找前驱和后继节点. 1: #include <cstdio> 2: #include <iostream> 3: #include <c ...

  6. 【学习总结】【多线程】 线程 & 进程 & NSThread(多线程的一套API)

    一.进程和线程 1.什么是进程 进程是指在系统中正在运行的一个应用程序 每个进程之间是独立的,每个进程均运行在其专用且受保护的内存空间内 比如同时打开 Chrome.Xcode,系统就会分别启动2个进 ...

  7. iOS的view翻转动画实现--代码老,供参考

    新建一个view-based模板工程,在ViewController文件中添加下面的代码,即可实现翻转效果: - (void)viewDidLoad { [super viewDidLoad]; // ...

  8. 去除C/C++程序代码中的注释

    最近搞软件著作权,去除代码空行和注释比较麻烦,想写个程序自动去除,去网上搜了下,发现有类似的程序,不过只有去除注释.鉴于word中可以去除空行(用^p^p替换^p),先用网上的代码,以后有时间写个完整 ...

  9. 安装oracle 11g详细过程仅供参考

  10. 团体程序设计天梯赛-练习集L1-024. 后天

    L1-024. 后天 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 如果今天是星期三,后天就是星期五:如果今天是星期六,后天就 ...