A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

继续上次的分享。这个是我为毕业设计准备的,主要用来完成后台页面的制作。前台配合NodeJs,做出一个比较完整的系统。作为毕业设计。现将笔记分享给大家,希望给和我一样准备毕业设计的同学一点小小的帮助。

属性
        position 'bottom'/string 消息框的位置,默认bottom,还可设置为left right top
        content null/string 消息框的内容,可以包含html标签
        trackMouse false/boolean 设置为true,则提示框跟随鼠标移动,否则不跟随
        detalX 0/number 水平方向提示框的位置
        detalY0/number 垂直方向提示框的位置
        showEvent 'mouseenter'/string 设置激活哪个事件时显示提示框
        hideEvent 'mouseleave'/string 设置激活哪个事件时隐藏提示框
        showDelay 200/number 延时多少毫秒显示提示框
        hideDelay 200/number 延时多少毫秒隐藏提示框

事件
        onShow 参数:e 在显示提示框的时候触发
        onHide 参数:e 在隐藏提示框的时候触发
        onUpdate 参数:e 在更新提示框内容的时触发
        onPosition 参数:e 在提示框位置发生改变的时候触发
        onDestroy 参数:none 在提示框被销毁的时候触发



方法
        options 参数:none 返回对象属性
        tip 参数:none 返回tip元素的属性
        arrow 参数:none 返回箭头元素的对象
        show 参数:e  显示提示框
        hide 参数:e 隐藏提示框
        update 参数:content 更新提示框内容
        reposition 参数:none 重置提示框
        destroy 参数:none 销毁提示框

修改默认对象:
        $.fn.tooltip.defaults.position = 'top'



示例代码:
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>jQuery Easy UI</title>
  5. <meta charset="UTF-8" />
  6. <script type="text/javascript" src="easyui/jquery.min.js"></script>
  7. <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
  8. <script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js" ></script>
  9. <link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css" />
  10. <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css" />
  11. <style tyle="text/css">
  12.         .red{
  13.                 color:red;
  14.                 font-weight:bold;
  15.         }
  16. </style>
  17. <script type="text/javascript">
  18.         $(function (){
  19.                 $('body').css('margin','100px');
  20.                 /*
  21.                 $('a').tooltip({
  22.                         content:'这是<span class="red">提示框</span>的内容',
  23.                         position:'top',
  24.                         trackMouse:true,
  25.                         deltaX:100,
  26.                         deltaY:100,
  27.                         showEvent:'click',
  28.                         hideEvent:'dbclick',
  29.                         showDelay:0,
  30.                         hideDelay:0,
  31.                        
  32.                         onShow:function (e){
  33.                                 console.log('onShow');

  34.                                 // var tooltip_arrow = $('.tooltip-arrow');
  35.                                 //console.log(tooltip_arrow);
  36.                                 console.log($('a').tooltip('arrow') );

  37.                         },
  38.                         onHide:function (e){
  39.                                 console.log('onHide');
  40.                         },
  41.                         onPosition:function (e){
  42.                                 console.log('onPosition');
  43.                         },
  44.                         onUpdate:function (e){
  45.                                 console.log('onUpdate');
  46.                         },
  47.                         onDestory:function (e){
  48.                                 console.log('onDestory');
  49.                         }
  50.                 });


  51.                 $('a').mouseenter(function (){
  52.                         $('.tooltip').css('left','200px');
  53.                 });

  54.                 $('a').mouseleave(function (){
  55.                         $('a').tooltip('reposition');
  56.                 });
  57.                

  58.                 $('#btnShow').click(function (){
  59.                         $('a').tooltip('show');
  60.                 });

  61.                 $('#btnHide').click(function (){
  62.                         $('a').tooltip('hide');
  63.                 });

  64.                 $('#btnDestroy').click(function (){
  65.                         $('a').tooltip('destroy');
  66.                 });
  67.         */

  68.                 // box开始
  69.                 $('#box').tooltip({
  70.                         content:'这是内容',
  71.                         onShow:function (e){
  72.                                 $('.tooltip-bottom').css('left','500px');
  73.                         },
  74.                         onHide:function (e){
  75.                                 $('#box').tooltip('reposition');
  76.                         }
  77.                 });

  78.         });

  79. </script>
  80. </head>
  81. <body>
  82.         <button id="btnShow">显示按钮</button>
  83.         <button id="btnHide">隐藏按钮</button>
  84.         <button id="btnDestroy">销毁按钮</button>
  85.         <a href="#">Hover me!</a>

  86.         <a href="#" id="box">Other Hover me!</a>


  87. </body>
  88. </html>

复制代码



0 个回复

您需要登录后才可以回帖 登录 | 加入黑马