easyui for jquery之tooltip
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ajax Tooltip - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Ajax Tooltip</h2>
<p>The tooltip content can be loaded via AJAX.</p>
<div style="margin:20px 0;"></div> <a href="#" data-tip="This is the tooltip message1." class="easyui-tooltip" data-options="
content: function(){
//return $('<div style=\'padding:5px;background:#eee;color:#000\'>This is the tooltip message.</div>');
//return $('#toolbar');
//return $(this).data('tip').;
return $('<div style=\'padding:5px;background:#eee;color:#000\'></div>').html($(this).data('tip'));
},
showEvent: 'mouseenter',
position: 'bottom',
onShow: function(){
var t = $(this);
t.tooltip('tip').unbind().bind('mouseenter', function(){
t.tooltip('show');
}).bind('mouseleave', function(){
t.tooltip('hide');
});
}
">Hove me</a> to display tooltip content via AJAX. <div style="display:none">
<div id="toolbar" style="padding:5px;background:#eee;color:#000">This is the tooltip message.</div>
</div>
</body>
</html>
清洁的代码整理如下
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tooltip - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
<script type="text/javascript">
//tip样式、显示\隐藏触发设置
function show(){
var t = $(this);
//tip样式设置小驼峰规则,marginLeft等同margin-left
t.tooltip('tip').css({
backgroundColor: '#fff000',
borderColor: '#ff0000',
boxShadow: '1px 1px 3px #292929',
marginLeft: '20px'
});
//tip显示\隐藏触发设置
t.tooltip('tip').unbind().bind('mouseenter', function(){
t.tooltip('show');
}).bind('mouseleave', function(){
t.tooltip('hide');
});
} //tip内容填充
function content(){
return $('<div></div>').append($(this).data('tip'));
}
</script>
<style type="text/css">
a {
line-height:80px;
} #container{
margin-left: 10px;
}
</style>
</head>
<body>
<div id="container">
<!--data-tip设置tip显示内容设置-->
<!--data-options中position: 'bottom'设置tip显示相对位置底部[bottom|top|left|right]-->
<!--data-options中showEvent: 'mouseenter'设置tip显示出发事件[mouseenter|click|none]-->
<a href="#" data-tip="This is the tooltip message." class="easyui-tooltip" data-options="content: content, showEvent: 'mouseenter', position: 'bottom', onShow: show">Hove me</a> to display tooltip content.<br />
<a href="#" data-tip="This is the tooltip message." class="easyui-tooltip" data-options="content: content, showEvent: 'mouseenter', position: 'bottom', onShow: show">Hove me</a> to display tooltip content.<br />
<a href="#" data-tip="This is the tooltip message." class="easyui-tooltip" data-options="content: content, showEvent: 'mouseenter', position: 'bottom', onShow: show">Hove me</a> to display tooltip content.<br />
<a href="#" data-tip="This is the tooltip message." class="easyui-tooltip" data-options="content: content, showEvent: 'mouseenter', position: 'bottom', onShow: show">Hove me</a> to display tooltip content.<br />
<a href="#" data-tip="This is the tooltip message." class="easyui-tooltip" data-options="content: content, showEvent: 'mouseenter', position: 'bottom', onShow: show">Hove me</a> to display tooltip content.<br />
</div>
</body>
</html>
再次优化后
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tooltip - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../tooltip.common.js"></script>
<style type="text/css">
a {
line-height:80px;
} #container {
margin-left: 10px;
}
</style>
</head>
<body>
<div id="container">
<!--data-tip设置tip显示内容-->
<!--data-options中position: 'bottom'设置tip显示相对位置底部[bottom|top|left|right]-->
<!--data-options中showEvent: 'mouseenter'设置tip显示出发事件[mouseenter|click|none]-->
<a href="#" data-tipcss=" backgroundColor: '#fff000',borderColor: '#ff0000',boxShadow: '1px 1px 3px #292929',marginLeft: '20px',width: '300px' " data-tipcontent="This is the tooltip message.This is the tooltip message." class="easyui-tooltip" data-options="content: tooltipcontent, showEvent: 'mouseenter', position: 'bottom', onShow: tooltipshow">Hove me</a> to display tooltip content.<br />
<a href="#" data-tipcss=" backgroundColor: '#fff000',borderColor: '#ff0000',boxShadow: '1px 1px 3px #292929',marginLeft: '20px',width: '300px' " data-tipcontent="This is the tooltip message." class="easyui-tooltip" data-options="content: tooltipcontent, showEvent: 'mouseenter', position: 'bottom', onShow: tooltipshow">Hove me</a> to display tooltip content.<br />
<a href="#" data-tipcss=" backgroundColor: '#fff000',borderColor: '#ff0000',boxShadow: '1px 1px 3px #292929',marginLeft: '20px',width: '300px' " data-tipcontent="This is the tooltip message." class="easyui-tooltip" data-options="content: tooltipcontent, showEvent: 'mouseenter', position: 'bottom', onShow: tooltipshow">Hove me</a> to display tooltip content.<br />
<a href="#" data-tipcss=" backgroundColor: '#fff000',borderColor: '#ff0000',boxShadow: '1px 1px 3px #292929',marginLeft: '20px',width: '300px' " data-tipcontent="This is the tooltip message." class="easyui-tooltip" data-options="content: tooltipcontent, showEvent: 'mouseenter', position: 'bottom', onShow: tooltipshow">Hove me</a> to display tooltip content.<br />
<a href="#" data-tipcss=" backgroundColor: '#fff000',borderColor: '#ff0000',boxShadow: '1px 1px 3px #292929',marginLeft: '20px',width: '300px' " data-tipcontent="This is the tooltip message." class="easyui-tooltip" data-options="content: tooltipcontent, showEvent: 'mouseenter', position: 'bottom', onShow: tooltipshow">Hove me</a> to display tooltip content.<br />
</div>
</body>
</html>
tooltip.common.js
//tip样式、显示\隐藏触发设置
function tooltipshow(){
var t = $(this);
//tip样式设置小驼峰规则,marginLeft等同margin-left
t.tooltip('tip').css(eval("({" + $(this).data('tipcss') + "})"));
//tip显示\隐藏触发设置
t.tooltip('tip').unbind().bind('mouseenter', function(){
t.tooltip('show');
}).bind('mouseleave', function(){
t.tooltip('hide');
});
} //tip内容填充
function tooltipcontent(){
return $('<div></div>').append($(this).data('tipcontent'));
}
easyui for jquery之tooltip的更多相关文章
- JQuery easyui (4)Tooltip (提示组件) 组件
ps:先来一波美图 Tooltip的加载方式: 1,class加载 <a href="#" title="tooltip">hello word&l ...
- JS框架_(JQuery.js)Tooltip弹出式按钮插件
百度云盘 传送门 密码:7eh5 弹出式按钮效果 <!DOCTYPE html> <html > <head> <meta charset="UTF ...
- easyui中jquery重复引用问题(tab内存泄露问题)
今天认真测试了下easyui的一些兼容性问题,发现在ie9 ie10 首次加载的时候,会出现如下bug.如图所示: 认真看了下,我估计是脚本重复引用的问题,我用的iframe框架的模式.登陆系统后,桌 ...
- Easyui 修改jquery validatebox为英文校验提示为中文提示
修改jquery validatebox为英文校验提示为中文提示 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3 问题描述: 如图,想把校验提示由英文改成中文 ...
- 解决 Jquery UI Tooltip 用在Select 的BUG
今天遇到一个奇葩问题, 在chrome下一切正常的 页面,在IE 下Select无法选中! 是的 ,就是无法选中!!! 效果就是这样的.http://jsfiddle.net/slolife/dp4 ...
- 基于jQuery的Tooltip
近来,要开发一个关务管理系统,为了增加系统美观度,自己开发了一个基于jQuery框的的小插件,与大家分享一下,希望大家能给我提出宝贵修改意见. 下面开发说明使用方法和内容: 一.引用jQuery框架, ...
- Jquery Easyui与Jquery Bootstrap的比较
1.easyui是js框架 :bootstrap 是css框架 ,bootstrap = 样式库 + 一堆jQuery插件,顺便解释一句,如果你只需要bootstrap的样式,你完全不用引入jQuer ...
- Jquery Easyui与Jquery Bootstrap(Metronic Bootstrap)的简单比较
1,通常来看WEB前端用 bootstrap 比较好,后台用EASYUI比较好.Easyui适合工厂企业的管理系统如ERP,CRM之类的,Bootstrap适用于多屏跨设备浏览. 简言之,一个适合上班 ...
- easyUI tree jQuery
Tree 数据转换 所有节点都包含以下属性: id:节点id,这个很重要到加载远程服务器数据 which is important to load remote data text: 显示的节点文本 ...
随机推荐
- 红米note2 刷机 注意问题:
其他的百度都有,用刷线宝刷 红米note2 刷机 注意问题: 关机状态线下,链接电脑,按着音量下键不松手,按电源键开机后松开,即进入刷机模式. 其中,红米,红米1s移动,红米note移动3g/联通 ...
- Ultra.Base
winform 基础类库 https://github.com/ZixiangBoy/Ultra.Base
- 【ABAP系列】SAP ALV 导出报表数据 始终使用选定的格式”,一旦勾上,就再也不会弹出选择框了。
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ALV 导出报表数据 始 ...
- unity全屏截图
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; ...
- Windows7 系统安装
转载请标明本文链接:(https://www.cnblogs.com/softwarecb/p/11773811.html) 目前微软已经停止支持Windows 7,而且由于芯片组更新的原因,新的硬件 ...
- 安全运维 - Linux系统攻击应急响应
Linux 应急相应 - 总纲 应急准备: 制定应急策略 组建应急团队 其他应急资源 安全事件处理: 痕迹数据获取 分析.锁定攻击源删除可疑账号关闭异常进程.端口禁用相应异常开机启动项删除异常定时任务 ...
- Java中StringHelp
import java.util.Collection; import java.util.Map; import java.util.UUID; public class StringHelper ...
- oracle--约束(主键、非空、检查)
问题1:学号重复了,数据还可以插入成功 使用主键约束:学号是唯一标识一条数据的,所以必须唯一且不能为空 ---(1).在确定为主键的字段后添加 primary key关键字 ---(2).在创建表的后 ...
- HDU2188选拔自愿者
悼念512汶川大地震遇难同胞--选拔志愿者 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- 问题 B: 傻鸡抓大闸蟹
问题 B: 傻鸡抓大闸蟹 时间限制: 1 Sec 内存限制: 128 MB提交: 94 解决: 39[提交] [状态] [命题人:jsu_admin] 题目描述 背景又到了吃大闸蟹的季节,黄老师想 ...