jquery mobile實(shí)現(xiàn)可折疊的導(dǎo)航按鈕
本文實(shí)例為大家分享了jquery實(shí)現(xiàn)可折疊的導(dǎo)航按鈕的具體代碼,供大家參考,具體內(nèi)容如下
功能:
當(dāng)功能較多時(shí),創(chuàng)建可折疊分組導(dǎo)航按鈕。只需指定 data-role=" collapsible "創(chuàng)建可折疊面板
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>可折疊的導(dǎo)航面板</title> <!--使用名為viewport的meta值,其content指定自適應(yīng)設(shè)備的寬度--> <meta name="viewport" content="width=device-width, initial-scale=1"> <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"> <div data-role="header"> <h1>圖書查閱系統(tǒng)</h1> </div> <!--創(chuàng)建一個(gè)可折疊的導(dǎo)航面板--> <div data-role="content"> <div data-role="collapsible" data-theme="e"> <h4>文學(xué)歷史</h4> <ul data-role="listview"> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >明代</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >宋代</a></li> </ul> </div> <!--顯示人文社科的可折疊面板--> <div data-role="collapsible" data-theme="b" data-collapsed="false"> <h4>人文社科</h4> <ul data-role="listview"> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >財(cái)務(wù)</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >心理</a></li> </ul> </div> <!--顯示計(jì)算機(jī)應(yīng)用的可折疊面板--> <div data-role="collapsible" data-theme="e"> <h4>計(jì)算機(jī)應(yīng)用</h4> <ul data-role="listview"> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >軟件開發(fā)</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >數(shù)據(jù)庫(kù)</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" >移動(dòng)開發(fā)</a></li> </ul> </div> </div> <div data-role="footer" data-position="fixed"> <h1>請(qǐng)單擊“+”按鈕進(jìn)行展開</h1> </div> </div> </body> </html>
代碼分析:
通過(guò)data-role=" collapsible "創(chuàng)建可折疊的div,再在其中通過(guò) data-role=" listview "創(chuàng)建列表框
data-theme : 指定預(yù)定義樣式 (也可以使用樣式構(gòu)建器創(chuàng)建自定義樣式)
data-collapsed="false" : 表示默認(rèn)不折疊
效果圖:

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- jQueryMobile之窗體長(zhǎng)內(nèi)容的缺陷與解決方法實(shí)例分析
- jQuery Mobile漏洞會(huì)有跨站腳本攻擊風(fēng)險(xiǎn)
- jquery mobile移動(dòng)端幻燈片滑動(dòng)切換效果
- jQuery-mobile事件監(jiān)聽與用法詳解
- jquery-mobile表單的創(chuàng)建方法詳解
- jquery-mobile基礎(chǔ)屬性與用法詳解
- jQuery Mobile和HTML5開發(fā)App推廣注冊(cè)頁(yè)
- 使用jQuery mobile NuGet讓你的網(wǎng)站在移動(dòng)設(shè)備上同樣精彩
相關(guān)文章
使用jquery獲取網(wǎng)頁(yè)中圖片高度的兩種方法
使用jquery獲取網(wǎng)頁(yè)中圖片的高度其實(shí)很簡(jiǎn)單,目前有兩種不錯(cuò)的方法可以實(shí)現(xiàn),下面為大家詳細(xì)介紹下,有所疑惑的你可以參考下2013-09-09
使用jQuery實(shí)現(xiàn)input數(shù)值增量和減量的方法
這篇文章主要介紹了使用jQuery實(shí)現(xiàn)input數(shù)值增量和減量的方法,實(shí)例分析了Bootstrap TouchSpin插件的用法,是非常實(shí)用的技巧,需要的朋友可以參考下2015-01-01
動(dòng)態(tài)生成的DOM不會(huì)觸發(fā)onclick事件的原因及解決方法
下面小編就為大家?guī)?lái)一篇?jiǎng)討B(tài)生成的DOM不會(huì)觸發(fā)onclick事件的原因及解決方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-08-08
jQuery插件DataTables分頁(yè)開發(fā)心得體會(huì)
這篇文章主要為大家分享了jQuery插件DataTables分頁(yè)開發(fā)心得體會(huì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08
jQuery實(shí)現(xiàn)可高亮顯示的二級(jí)CSS菜單效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)可高亮顯示的二級(jí)CSS菜單效果,涉及基本的jquery鼠標(biāo)事件及頁(yè)面元素樣式動(dòng)態(tài)改變技巧,需要的朋友可以參考下2015-09-09
對(duì)jQuery的事件綁定的一些思考(補(bǔ)充)
一般jquery事件綁定會(huì)帶來(lái)過(guò)多的事件綁定會(huì)損耗內(nèi)存,后期生成HTML會(huì)沒有事件綁定,需要重新綁定,語(yǔ)法過(guò)于繁雜等問(wèn)題2013-04-04

