jquery实现简单文字提示效果
作者:bea
本文实例讲述了jquery实现简单文字提示效果。分享给大家供大家参考,具体如下: <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>jquery实现简单文字提示</title><style type="tex
本文实例讲述了jquery实现简单文字提示效果。分享给大家供大家参考,具体如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>jquery实现简单文字提示</title>
<style type="text/css">
#preview{border:2px solid #c7c7c7; background:#e3f4f9; padding:5px; display:none; position:absolute;}
</style>
<script src="jquery-1.2.6.pack.js" type="text/javascript"></script>
</head>
<body>
<a class="preview" title="看看提示出现了没">移到我身上来!!</a>
<script type="text/javascript">
this.imagePreview = function(){
/* CONFIG */
xOffset = 10;
yOffset = 20;
// 可以自己设定偏移值
/* END CONFIG */
$("a.preview").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "" + this.t : "";
$("body").append("<div id='preview'>"+ c +"</div>");
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#preview").remove();
});
$("a.preview").mousemove(function(e){
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
// 页面加载完执行
$(document).ready(function(){
imagePreview();
});
</script>
</body>
</html>
jquery-1.2.6.pack.js插件点击此处本站下载。
希望本文所述对大家jQuery程序设计有所帮助。
有用 | 无用
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>jquery实现简单文字提示</title>
<style type="text/css">
#preview{border:2px solid #c7c7c7; background:#e3f4f9; padding:5px; display:none; position:absolute;}
</style>
<script src="jquery-1.2.6.pack.js" type="text/javascript"></script>
</head>
<body>
<a class="preview" title="看看提示出现了没">移到我身上来!!</a>
<script type="text/javascript">
this.imagePreview = function(){
/* CONFIG */
xOffset = 10;
yOffset = 20;
// 可以自己设定偏移值
/* END CONFIG */
$("a.preview").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "" + this.t : "";
$("body").append("<div id='preview'>"+ c +"</div>");
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#preview").remove();
});
$("a.preview").mousemove(function(e){
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};
// 页面加载完执行
$(document).ready(function(){
imagePreview();
});
</script>
</body>
</html>
jquery-1.2.6.pack.js插件点击此处本站下载。
希望本文所述对大家jQuery程序设计有所帮助。
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- 全面解析Bootstrap图片轮播效果
- 谈谈基于iframe、FormData、FileReader三种无刷新上传文件的方法
- 解决JavaScript数字精度丢失问题的方法
- Javascript实现检测客户端类型代码封包
- javascript学习小结之prototype
- 简单实现JS对dom操作封装
- jQuery实现获取绑定自定义事件元素的方法
- JS折半插入排序算法实例
- 如何动态加载外部Javascript文件
- javascript实现获取浏览器版本、浏览器类型
- JavaScript如何禁止Backspace键
- js文本框输入内容智能提示效果
- JavaScript使用DeviceOne开发实战(四)仿优酷视频应用
- Jquery左右滑动插件之实现超级炫酷动画效果附源码下载
- jQuery 1.9.1源码分析系列(十四)之常用jQuery工具
- jQuery 1.9.1源码分析系列(十三)之位置大小操作
- 解决jQuery使用JSONP时产生的错误
- jquery实现触发时更新下拉列表内容的方法
- jQuery简单实现input文本框内灰色提示文本效果的方法