jQuery Mobile彈出窗、彈出層知識(shí)匯總
先創(chuàng)建一個(gè)窗體
<div data-role="popup" id="popupView" class="ui-content" data-overlay-theme="b" data-position-to="window" data-dismissible="false"> <a href='javascript:void(0)' data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a> <div>彈出窗內(nèi)容<div> </div>
1)點(diǎn)擊后彈出
<a href="#popupView" data-rel="popup" data-transition="flip" class="ui-btn ui-corner-all">按鈕</a>
2)頁(yè)面加載后彈出
//頁(yè)面延時(shí)加載<script> setTimeout(function () { $("#popupView").popup('open'); }, 1000);//1秒</script>
關(guān)鍵字說(shuō)明:
data-overlay-theme: 背景色透明灰 data-position-to: 彈窗在窗口居中顯示 data-dismissible: 是否允許單擊窗口外任一位置關(guān)閉窗口(默認(rèn)true為允許) data-transition: 彈出方式
下面通過(guò)代碼實(shí)例詳解jquery mobile 彈出層使用
引入文件
<head> <link rel="stylesheet" > <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head>
彈出層基礎(chǔ)
創(chuàng)建一個(gè)彈出層,要在div標(biāo)簽中添加一個(gè) data-role="popup" 屬性,然后在添加一個(gè)a標(biāo)簽,并在a標(biāo)簽href屬性中設(shè)置彈出div層的id,在a標(biāo)簽中添加屬性
data-rel="popup" To create a popup, add the data-role="popup" attribute to a div with the popup contents. Then create a link with the href set to the id of the popup div, and add the attribute data-rel="popup" to tell the framework to open the popup when the link is tapped. A popup div has to be nested inside the same page as the link. <a href="#popupBasic" data-rel="popup" class="ui-btn ui-corner-all ui-shadow ui-btn-inline" data-transition="pop">Basic Popup</a> <div data-role="popup" id="popupBasic"> <p>This is a completely basic popup, no options set.</p> </div>
簡(jiǎn)單實(shí)例
<!DOCTYPE html> <html> <head> <link rel="stylesheet" > <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head> <body> <div data-role="page" id="pageone"> <a href="#popupBasic" data-rel="popup" class="ui-btn ui-corner-all ui-shadow ui-btn-inline" data-transition="pop">點(diǎn)擊我彈出層</a> <div data-role="popup" id="popupBasic"> <p>彈出層測(cè)試</p> </div> </div> </body> </html>
工具提示可以通過(guò)添加一個(gè)主題創(chuàng)建樣本基本通過(guò)ui-content彈出并添加填充
A tooltip can be created by adding a theme swatch to a basic popup and adding padding via the ui-content class. <p>A paragraph with a tooltip. <a href="#popupInfo" data-rel="popup" data-transition="pop" class="my-tooltip-btn ui-btn ui-alt-icon ui-nodisc-icon ui-btn-inline ui-icon-info ui-btn-icon-notext" title="Learn more">Learn more</a></p> <div data-role="popup" id="popupInfo" class="ui-content" data-theme="a" style="max-width:350px;"> <p>Here is a <strong>tiny popup</strong> being used like a tooltip. The text will wrap to multiple lines as needed.</p> </div>
提示信息實(shí)例
<!DOCTYPE html> <html> <head> <link rel="stylesheet" > <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head> <body> <div data-role="page" id="pageone"> <p>A paragraph with a tooltip. <a href="#popupInfo" data-rel="popup" data-transition="pop" class="my-tooltip-btn ui-btn ui-alt-icon ui-nodisc-icon ui-btn-inline ui-icon-info ui-btn-icon-notext" title="Learn more">Learn more</a></p> <div data-role="popup" id="popupInfo" class="ui-content" data-theme="a" style="max-width:350px;"> <p>Here is a <strong>tiny popup</strong> being used like a tooltip. The text will wrap to multiple lines as needed.</p> </div> </div> </body> </html>
彈出圖片
<!DOCTYPE html> <html> <head> <link rel="stylesheet" > <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> </head> <body> <div data-role="page" id="pageone"> <a href="#popupParis" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="http://demos.jquerymobile.com/1.4.3/_assets/img/paris.jpg" alt="Paris, France" style="width:30%"></a> <a href="#popupSydney" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="http://demos.jquerymobile.com/1.4.3/_assets/img/sydney.jpg" alt="Sydney, Australia" style="width:30%"></a> <a href="#popupNYC" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="http://demos.jquerymobile.com/1.4.3/_assets/img/newyork.jpg" alt="New York, USA" style="width:30%"></a> <div data-role="popup" id="popupParis" data-overlay-theme="b" data-theme="b" data-corners="false"> <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a><img class="popphoto" src="http://demos.jquerymobile.com/1.4.3/_assets/img/paris.jpg" style="max-height:512px;" alt="Paris, France"> </div> <div data-role="popup" id="popupSydney" data-overlay-theme="b" data-theme="b" data-corners="false"> <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a><img class="popphoto" src="http://demos.jquerymobile.com/1.4.3/_assets/img/sydney.jpg" style="max-height:512px;" alt="Sydney, Australia"> </div> <div data-role="popup" id="popupNYC" data-overlay-theme="b" data-theme="b" data-corners="false"> <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a><img class="popphoto" src="http://demos.jquerymobile.com/1.4.3/_assets/img/newyork.jpg" style="max-height:512px;" alt="New York, USA"> </div> </div> </body> </html>
- jQuery+CSS3+Html5實(shí)現(xiàn)彈出層效果實(shí)例代碼(附源碼下載)
- Jquery+CSS3實(shí)現(xiàn)一款簡(jiǎn)潔大氣帶滑動(dòng)效果的彈出層
- jQuery Dialog 彈出層對(duì)話框插件
- jQuery彈出層始終垂直居中相對(duì)于屏幕或當(dāng)前窗口
- jquery實(shí)現(xiàn)居中彈出層代碼
- JQuery彈出層示例可自定義
- jQuery+html5實(shí)現(xiàn)div彈出層并遮罩背景
- jQuery插件zoom實(shí)現(xiàn)圖片全屏放大彈出層特效
- JQUERY THICKBOX彈出層插件
- jQuery點(diǎn)縮略圖彈出層顯示大圖片
- jQuery Layer彈出層傳值到父頁(yè)面的實(shí)現(xiàn)代碼
- jquery+css3實(shí)現(xiàn)的經(jīng)典彈出層效果示例
相關(guān)文章
jquery改變disabled的boolean狀態(tài)的三種方法
改變disabled的boolean狀態(tài),下面為大家介紹三種比較不錯(cuò)的方法,大家可以參考下2013-12-12jQuery EasyUI 中文API Layout(Tabs)
發(fā)布jQuery EasyUI 中文API—Layout(Tabs)總結(jié),需要的朋友可以參考下。2010-04-04基于jquery的點(diǎn)擊鏈接插入鏈接內(nèi)容的代碼
基于jquery的點(diǎn)擊鏈接插入鏈接內(nèi)容的代碼,感覺有bug,解決的朋友可以留言方便更多的朋友2012-07-07jQuery實(shí)現(xiàn)鼠標(biāo)移入移出事件切換功能示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)鼠標(biāo)移入移出事件切換功能,結(jié)合實(shí)例形式分析了jQuery不同版本處理鼠標(biāo)事件響應(yīng)與觸發(fā)相關(guān)操作技巧,需要的朋友可以參考下2018-09-09jQuery實(shí)現(xiàn)立體式數(shù)字滾動(dòng)條增加效果
這篇文章主要介紹了jQuery立體式數(shù)字滾動(dòng)條增加的相關(guān)資料,代碼簡(jiǎn)單易懂,非常不錯(cuò),需要的朋友可以參考下2016-12-12基于jquery中children()與find()的區(qū)別介紹
本篇文章介紹了,基于jquery中children()與find()的區(qū)別,需要的朋友參考下2013-04-04