jquery.qtip提示信息插件用法簡(jiǎn)單實(shí)例
本文實(shí)例講述了jquery.qtip提示信息插件用法。分享給大家供大家參考,具體如下:
公司要求寫(xiě)一個(gè)關(guān)于提示信息的效果,在網(wǎng)上查詢到了這個(gè)插件,感覺(jué)很不錯(cuò),下面是自己學(xué)習(xí)的內(nèi)容
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script src="lib/jquery-1.6.4.min.js" type="text/javascript"></script> <script type="text/javascript" src="lib/jquery.qtip-1.0.0-rc3.min.js"></script> <script type="text/javascript"> $(document).ready( function(){ //下面使用的是插件默認(rèn)的樣式顯示,content是指要顯示的內(nèi)容(包括文字和圖片) $("#huangbiao").qtip({ content: 'Stems are great for indicating the context of the tooltip.', style: { tip: 'bottomLeft' // Notice the corner value is identical to the previously mentioned positioning corners } }); //style json是對(duì)提示樣式的設(shè)置即外面的div樣式設(shè)置,但是沒(méi)有設(shè)置具體的位置 $("#huangbiao1").qtip({ content: '設(shè)置顯示文字樣式', style: { width: 200, padding: 5, background: '#A2D959', color: 'black', textAlign: 'center', border: { width: 7, radius: 5, color: '#A2D959' }, tip: 'bottomLeft', name: 'dark' // Inherit the rest of the attributes from the preset dark style } }); //name:'green' 是繼承了默認(rèn)的提示樣式,還有其他的name可以參考幫助文檔 $("#huangbiao2").qtip({ content: '使用插件自定義的樣式', style: { name: 'green' // Notice the corner value is identical to the previously mentioned positioning corners } }); //target:表示提示信息顯示在控件的什么位置 //tooltip: $("#huangbiao3").qtip({ content: 'Stems are great for indicating the context of the tooltip.', position: { corner: { target: 'topLeft', tooltip: 'bottomLeft' } } }); $("#huangbiao4").qtip({ content: '<img src="img/2.jpg">', }); //show 是指顯示的情況,when是指什么事件觸發(fā)讓它顯示出來(lái),hide與show對(duì)應(yīng) //solo: $("#huangbiao5").qtip({ content: '<img src="img/2.jpg">', show:{ when:'click', solo:false }, hide:{ when:'click', solo:false } }); //顯示類(lèi)似于“窗口”模式的樣式,含有title和內(nèi)容的提示信息 $("#huangbiao6").qtip({ content: { title: { text: 'content-title-text', button: 'button' }, text: 'content-text' }, fixed:true }); //api:是回調(diào)函數(shù),beforeShow是在顯示提示之前的提示信息,beforeHide則恰好相反;onRender是指內(nèi)容呈現(xiàn)后調(diào)用 $("#huangbiao7").qtip({ content: 'use callback function', api:{ beforeShow:function(){ alert("beforeShow api function"); }, beforeHide:function(){ alert("beforeHide api function"); } } }); $("#huangbiao9").qtip({ content: '', style:{ width:"1024px", height:"1024px", background:"black" } }); } ); </script> <title>無(wú)標(biāo)題文檔</title> </head> <div style="text-align:center;"><span id="huangbiao">顯示普通文字</span></div> <p> <div style="text-align:center;"><span id="huangbiao1">設(shè)置顯示文字樣式</span></div> <p> <div style="text-align:center;"><span id="huangbiao2">使用插件自定義的樣式</span></div> <p> <div style="text-align:center;"><span id="huangbiao3">設(shè)置提示的顯示位置</span></div> <p> <div style="text-align:center;"><span id="huangbiao4">顯示圖片</span></div> <p> <div style="text-align:center;"><span id="huangbiao5">點(diǎn)擊事件顯示以及隱藏提示</span></div> <p> <div style="text-align:center;"><span id="huangbiao6">含有標(biāo)題的提示信息</span></div> <p> <div style="text-align:center;"><span id="huangbiao7">使用回調(diào)函數(shù)</span></div> <p> <div style="text-align:center;"><span id="huangbiao9">遮蓋全屏</span></div> <body> </body> </html>
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
相關(guān)文章
jQuery Collapse1.1.0折疊插件簡(jiǎn)單使用
這篇文章主要介紹了jQuery Collapse1.1.0折疊插件的使用方法 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08jquery控制listbox中項(xiàng)的移動(dòng)并排序
以下是用jquery控制ASP.NET中的兩個(gè)asp:listbox控件中選擇項(xiàng)的移動(dòng)。2009-11-11jquery $(document).ready() 與window.onload的區(qū)別
Jquery中$(document).ready()的作用類(lèi)似于傳統(tǒng)JavaScript中的window.onload方法,不過(guò)與window.onload方法還是有區(qū)別的。2009-12-12利用jQuery實(shí)現(xiàn)滑動(dòng)開(kāi)關(guān)按鈕效果(附demo源碼下載)
這篇文章主要介紹了利用jQuery實(shí)現(xiàn)滑動(dòng)開(kāi)關(guān)按鈕效果,文中給出了詳細(xì)的介紹,并在文末給出了完整的demo源碼下載,有需要的朋友可以參考簡(jiǎn)介,下面來(lái)一起看看吧。2017-02-02jQuery實(shí)現(xiàn)點(diǎn)擊按鈕文字變成input框點(diǎn)擊保存變成文字
這篇文章主要介紹了jQuery實(shí)現(xiàn)點(diǎn)擊按鈕文字變成input框點(diǎn)擊保存變成文字的相關(guān)資料,非常具有參考借鑒價(jià)值,需要的朋友可以參考下2016-05-05