Tooltip 提示框组件

可独立于其他组件
通过$.fn.tooltip.defaults重写默认的defaults。
当用户移动鼠标指针在某个元素上时,出现提示信息窗口来显示额外信息。提示内容可以包含任何来自页面的或者通过ajax生成的html元素。

1、创建提示框
从标记创建提示框(tooltip),添加‘easyui-tooltip’ class到元素,不需要任何的javascript代码
<a href="#" title="This is the tooltip message." class="rasyui-tooltip">Hover me</a>

使用js创建提示框(tooltip)
<a id="dd" href="javascript:void(0)">Click here</a>

$("#dd").tooltip({
position:'right',
content: '<span style="color:#fff">This is the tooltip message.</span>',
onShow:function(){
$(this).tooltip('tip').css({
backgroundColor:"#666",
borderColor:"#666"
});
}
});

2、属性
position string 提示框(tooltip)位置。可能的值:‘left’,‘right’,‘top’,‘bottom’ bottom
content string 提示框(tooltip)内容,可以放html标签 null
trackMouse boolean 如果设置为true,提示框(tooltip)会随着鼠标移动 false
deltaX number 提示框(tooltip)位置的水平距离 0
deltaY number 提示框(tooltip)位置的垂直距离 0
showEvent string 引发提示框(tooltip)出现的事件 mouseenter
hideEvent string引发提示框(tooltip)消失的事件 mouseleave
showDelay number 显示提示框(tooltip)的时间延迟 200
hideDelay number 隐藏提示框(tooltip)的时间延迟 100

3、事件
onShow e 当显示提示框(tooltip)时触发
onHide e 当隐藏提示框(tooltip)时触发
onUpdate content 当提示框(tooltip)内容更新时触发
onPosition left,top 当提示框(tooltip)位置更改时触发
onDestory none 当提示框(tooltip)销毁时触发

4、方法
options none 返回选项(options)属性(property)
tip none 返回提示(tip)对象
arrow none 返回箭头(arrow)对象
show e 显示提示框(tooltip)
hide e 隐藏提示框(tooltip)
update content 更新提示框(tooltip)内容
reposition none 重置提示框(tooltip)位置
destory none 销毁提示框(tooltip)

<html>
<title>index</title>
<head>
<meta charset="UTF-8"> <script type="text/javascript" src="easyui/jquery.min.js"></script>
<script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
</head>
<body>
<div style="width:400px;height:400px; margin-left:400px; margin-top:100px;">
<!--
<a href="javascript:void(0)" title="This is the tooltip message" class="easyui-tooltip">Hover me</a>
-->
<a id="box" href="javascript:void(0)">Hover me</a> </div> </body>
</html> $(function(){
$.fn.tooltip.defaults.trackMouse = true;
$("#box").tooltip({
//position : "right",
content : "<strong>this is comment!</strong>",
//trackMouse : true,
//deltaX : 30,
//deltaY : 30,
//showEvent : "click", //单击
//hideEvent : "dblclick", //双击
//showDelay : 1500, //单位毫秒
//hideDelay : 1500,
//onShow : function(e){
//console.log("提示框显示");
//console.log($("#box").tooltip('tip'));
//console.log($("#box").tooltip('arrow'));
//$(".tooltip-bottom").css('left',900);
//},
//onHide : function(e){
//console.log("提示框隐藏");
//},
//onPosition : function(left , top){
//console.log("提示框移动");
//},
onDestory : function(e){
console.log("提示框销毁");
},
//onUpdate : function(content){
//console.log("新的提示框内容:" + content);
//}
}); //$("#box").click(function(){
//$(this).tooltip('update','改变了');
//});
//$("#box").click(function(){
//$(this).tooltip('reposition');
//$(this).tooltip('destory');
//}); //console.log($("#box").tooltip("options"));
//$("#box").tooltip("show");
//$("#box").tooltip("hide"); });

我使用$("#box").tooltip('destory');销毁提示框的时候总是报错

tooltip提示框组件的更多相关文章

  1. 第一百九十六节,jQuery EasyUI,Tooltip(提示框)组件

    jQuery EasyUI,Tooltip(提示框)组件 学习要点: 1.加载方式 2.属性列表 3.事件列表 4.方法列表 本节课重点了解 EasyUI 中 Tooltip(提示框)组件的使用方法, ...

  2. Tooltip(提示框)组件

    一.加载方式 //class加载方式 <a href="http://www.ycku.com" title="这是一个提示信息!" class=&quo ...

  3. Echarts数据可视化tooltip提示框,开发全解+完美注释

    全栈工程师开发手册 (作者:栾鹏) Echarts数据可视化开发代码注释全解 Echarts数据可视化开发参数配置全解 6大公共组件详解(点击进入): title详解. tooltip详解.toolb ...

  4. 纯CSS实现tooltip提示框,CSS箭头及形状之续篇--给整个tooltip提示框加个边框

    在前面一篇中我们介绍了纯CSS实现tooltip提示框,通俗的讲也就是CSS箭头及形状 不过注意一点是,他始终是一个元素,只是通过CSS实现的,今天我们要说的是给这个“tooltip提示框”整体加一个 ...

  5. 使用css实现全兼容tooltip提示框

    在上一篇文章中,使用css实现了一个全兼容的三角形图标,这个三角型图标可以使用于多种场景,比如下拉图标.多级菜单等,这篇文章我们使用这个图标通过纯css来实现一个我们常见的tooltip提示框. 最终 ...

  6. CSS3实现Tooltip提示框飞入飞出动画

    原文:CSS3实现Tooltip提示框飞入飞出动画 我们见过很多利用背景图片制作的Tooltip提示框,但是缺点是扩展比较麻烦,要经常改动图片.还有就是利用多层CSS的叠加实现,但是效果比较生硬,外观 ...

  7. echarts中tooltip提示框位置控制

    关键代码: position: function(point, params, dom, rect, size) { //其中point为当前鼠标的位置,size中有两个属性:viewSize和con ...

  8. MFC中添加ToolTip提示框

    PART 1 MFC 对话框中的 Buttton添加提示 例如我们想在一个对话框中的一个button控件添加tooltip,实现的方法如下: 1. 在该对话框的类中添加一个CToolTipCtrl类型 ...

  9. echarts自定义tooltip提示框内容

    1.echarts自定义tooltip提示框内容 https://blog.csdn.net/dreamsup/article/details/56667330 2.关于Echarts的formatt ...

随机推荐

  1. PHP联接MySQL

    <?php echo "This is a test</br>"; echo "asdfasdfadsf"; $mysql_server_na ...

  2. git删除本地分支和删除远程分支

    引言: 切换分支的时候命令打错了,git checkout 后面没有跟分支名,结果git status,很多delete的文件,直接冒冷汗,git add ,commit 之后发现本地与远程确实是删除 ...

  3. 写写Web API基础

    前两天突然心血来潮,对WEB Api 来了复习兴趣,虽然有很长时间没用了,现在有点迷湖.呀的!在VS2013的MVC项目(基于VS2012/MVC4的,如果是VS2013下的MVc5时,创建时勾上We ...

  4. mfc配置CAN通信

    配置:把kerneldlls文件夹.ControlCAN.dll.ControlCAN.lib放在工程下面(debug和Release下面,最后需要exe和这些文件在一起):右键工程属性,链接器-&g ...

  5. python-作用域和装饰器

    Python 作用域 学习的时机: 基本的数据类型 Python的运算 数字运算 + - * / // ** 逻辑运算 And or not 比较运算 > < == >= <= ...

  6. 爬虫之动态HTML处理(Selenium与PhantomJS )动态页面模拟点击

    动态页面模拟点击 #!/usr/bin/env python # -*- coding:utf-8 -*- # python的测试模块 import unittest from selenium im ...

  7. LeetCode——3Sum Closest

    Question Given an array S of n integers, find three integers in S such that the sum is closest to a ...

  8. mysql中group by存在局限性探讨(待续)

    现在有一个需求:在2018年游戏充值记录表(字段主要有: user_name , money , game_id , 表有6000w行)查找出哪些人在某段日期内累计充值金额在100~500元范围内的, ...

  9. AVL树 - 学习笔记

    2017-08-29 14:35:55 writer:pprp AVL树就是带有平衡条件的二叉查找树.每个节点的左子树和右子树高度相差最多为1的二叉查找树 空树的高度定为-1 对树的修正称为旋转 对内 ...

  10. jQuery loop over JSON字符串 – $.each实例

    先来一段简单的javascript对象的遍历: var json = [ {"id":"1","tagName":"apple&q ...