jquery 提示信息

  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羣)


發佈了27 篇原創文章 · 獲贊 0 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章