jquery 提示信息

来源:互联网 发布:mysql 优化 百度云 编辑:程序博客网 时间:2024/05/09 18:51
  1. http://craigsworks.com/projects/qtip2/download


  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  3. <html xmlns="http://www.w3.org/1999/xhtml">  
  4. <head>  
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />  
  6. <script src="lib/jquery-1.6.4.min.js" type="text/javascript"></script>  
  7. <script type="text/javascript" src="lib/jquery.qtip-1.0.0-rc3.min.js"></script>   
  8. <script type="text/javascript">  
  9. $(document).ready(  
  10.     function(){  
  11.         //下面使用的是插件默认的样式显示,content是指要显示的内容(包括文字和图片)  
  12.         $("#huangbiao").qtip({  
  13.             content: 'Stems are great for indicating the context of the tooltip.',  
  14.             style: {   
  15.                 tip: 'bottomLeft' // Notice the corner value is identical to the previously mentioned positioning corners  
  16.             }  
  17.         });  
  18.           
  19.         //style json是对提示样式的设置即外面的div样式设置,但是没有设置具体的位置  
  20.         $("#huangbiao1").qtip({  
  21.             content: '设置显示文字样式',  
  22.             style: {   
  23.                 width: 200,  
  24.                 padding: 5,  
  25.                 background: '#A2D959',  
  26.                 color: 'black',  
  27.                 textAlign: 'center',  
  28.                 border: {  
  29.                     width: 7,  
  30.                     radius: 5,  
  31.                     color: '#A2D959'  
  32.                 },  
  33.                 tip: 'bottomLeft',  
  34.                 name: 'dark' // Inherit the rest of the attributes from the preset dark style  
  35.             }  
  36.         });  
  37.           
  38.         //name:'green' 是继承了默认的提示样式,还有其他的name可以参考帮助文档  
  39.         $("#huangbiao2").qtip({  
  40.             content: '使用插件自定义的样式',  
  41.             style: {   
  42.                 name: 'green' // Notice the corner value is identical to the previously mentioned positioning corners  
  43.             }  
  44.         });  
  45.           
  46.         //target:表示提示信息显示在控件的什么位置  
  47.         //tooltip:  
  48.         $("#huangbiao3").qtip({  
  49.             content: 'Stems are great for indicating the context of the tooltip.',  
  50.             position: {  
  51.                 corner: {  
  52.                     target: 'topLeft',  
  53.                     tooltip: 'bottomLeft'  
  54.                 }  
  55.             }  
  56.         });  
  57.           
  58.         $("#huangbiao4").qtip({  
  59.             content: '<img src="img/2.jpg">',  
  60.         });  
  61.           
  62.         //show 是指显示的情况,when是指什么事件触发让它显示出来,hide与show对应  
  63.         //solo:  
  64.         $("#huangbiao5").qtip({  
  65.             content: '<img src="img/2.jpg">',  
  66.             show:{  
  67.                 when:'click',  
  68.                 solo:false  
  69.             },  
  70.             hide:{  
  71.                 when:'click',  
  72.                 solo:false  
  73.             }  
  74.         });  
  75.           
  76.         //显示类似于“窗口”模式的样式,含有title和内容的提示信息  
  77.         $("#huangbiao6").qtip({  
  78.             content: {    
  79.                 title: {    
  80.                     text: 'content-title-text',    
  81.                     button: 'button'    
  82.                 },    
  83.                 text: 'content-text'    
  84.             },  
  85.             fixed:true  
  86.         });  
  87.           
  88.         //api:是回调函数,beforeShow是在显示提示之前的提示信息,beforeHide则恰好相反;onRender是指内容呈现后调用  
  89.         $("#huangbiao7").qtip({  
  90.             content: 'use callback function',  
  91.             api:{  
  92.                 beforeShow:function(){  
  93.                     alert("beforeShow api function");  
  94.                 },    
  95.                 beforeHide:function(){  
  96.                     alert("beforeHide api function");  
  97.                 }  
  98.             }  
  99.         });  
  100.           
  101.         $("#huangbiao9").qtip({  
  102.             content: '',  
  103.             style:{  
  104.                 width:"1024px",  
  105.                 height:"1024px",  
  106.                 background:"black"  
  107.             }  
  108.         });  
  109.     }     
  110. );  
  111.   
  112. </script>  
  113. <title>无标题文档</title>  
  114. </head>  
  115.     <div  style="text-align:center;"><span id="huangbiao">显示普通文字</span></div>  
  116.     <p>  
  117.     <div  style="text-align:center;"><span id="huangbiao1">设置显示文字样式</span></div>  
  118.     <p>  
  119.     <div  style="text-align:center;"><span id="huangbiao2">使用插件自定义的样式</span></div>  
  120.     <p>  
  121.     <div  style="text-align:center;"><span id="huangbiao3">设置提示的显示位置</span></div>  
  122.     <p>  
  123.     <div  style="text-align:center;"><span id="huangbiao4">显示图片</span></div>  
  124.     <p>  
  125.     <div  style="text-align:center;"><span id="huangbiao5">点击事件显示以及隐藏提示</span></div>  
  126.     <p>  
  127.     <div  style="text-align:center;"><span id="huangbiao6">含有标题的提示信息</span></div>  
  128.     <p>  
  129.     <div  style="text-align:center;"><span id="huangbiao7">使用回调函数</span></div>  
  130.     <p>  
  131.     <div  style="text-align:center;"><span id="huangbiao9">遮盖全屏</span></div>  
  132. <body>  
  133. </body>  
  134. </html>

(162703689 天天网络一族qq群)


原创粉丝点击