jQueryMobile之窗體長內(nèi)容的缺陷與解決方法實例分析
本文實例講述了jQueryMobile窗體長內(nèi)容的缺陷與解決方法。分享給大家供大家參考,具體如下:
前面的一篇文章《jQueryMobile之Helloworld與頁面切換的方法》沒有考慮到窗體中放置長內(nèi)容的狀況
一旦窗體中出現(xiàn)長內(nèi)容,使用筆者那種固定header與footer的全屏布局是存在缺陷的,
如圖所示,長內(nèi)容最后的內(nèi)容,直到滾動條拉到最底部也無法窮盡,
而且很有可能的是,雖然現(xiàn)在這個地方的內(nèi)容是顯示為半透明,但往往這個位置是一些提交按鈕什么的,
用戶根本就沒法點,
因此,需要進(jìn)行改進(jìn),把原來的代碼:
<!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=utf-8" /> <title>a</title> <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no"> <link rel="stylesheet" href="jqmobile/jquery.mobile-1.4.5.css" rel="external nofollow" rel="external nofollow" > <script src="jqmobile/jquery-1.11.1.js"></script> <script src="jqmobile/jquery.mobile-1.4.5.js"></script> </head> <body> <div data-role="page" data-position="fixed" data-fullscreen="true"> <div data-role="header" data-theme="b" data-tap-toggle = "false"> <h1>title</h1> </div> <div data-role="content"> <p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p> </div> <div data-role="footer" data-position="fixed" data-fullscreen="true" data-theme="b" data-tap-toggle = "false"> <div data-role="navbar"> <ul> <li><a href="a.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="info">a</a></li> <li><a href="b.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="grid">b</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" class="ui-btn-active ui-state-persist" data-icon="star">c</a></li> </ul> </div> </div> </div> </body> </html>
之中的content圖層加上樣式,style="margin-bottom:50px"也就是變成:
<!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=utf-8" /> <title>a</title> <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no"> <link rel="stylesheet" href="jqmobile/jquery.mobile-1.4.5.css" rel="external nofollow" rel="external nofollow" > <script src="jqmobile/jquery-1.11.1.js"></script> <script src="jqmobile/jquery.mobile-1.4.5.js"></script> </head> <body> <div data-role="page" data-position="fixed" data-fullscreen="true"> <div data-role="header" data-theme="b" data-tap-toggle = "false"> <h1>title</h1> </div> <div data-role="content" style="margin-bottom:50px"> <p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p><p>本頁還在建設(shè)中</p> </div> <div data-role="footer" data-position="fixed" data-fullscreen="true" data-theme="b" data-tap-toggle = "false"> <div data-role="navbar"> <ul> <li><a href="a.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="info">a</a></li> <li><a href="b.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="grid">b</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" class="ui-btn-active ui-state-persist" data-icon="star">c</a></li> </ul> </div> </div> </div> </body> </html>
則可以窮盡頁面了,如下圖所示:
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery切換特效與技巧總結(jié)》、《jQuery遍歷算法與技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計有所幫助。
相關(guān)文章
jQuery.event兼容各瀏覽器的event詳細(xì)解析
jQuery在遵循W3C規(guī)范的情況下,對事件的常用屬性進(jìn)行了封裝,使得事件處理在各大瀏覽器下都可以正常的運行而不需要進(jìn)行瀏覽器類型判斷2013-12-12使用jquery.qrcode.min.js實現(xiàn)中文轉(zhuǎn)化二維碼
本文給大家介紹的是一款jQuery的插件jquery.qrcode.min.js,其主要功能是可以生成二維碼,而且可以完美支持中文,下面就給小伙伴們介紹下他的用法2016-03-03Jquery實現(xiàn)兼容各大瀏覽器的Enter回車切換輸入焦點的方法
本文主要講解的是在做項目中遇到需要Enter回車切換輸入焦點的解決思路以及最終解決方案,很簡單,需要的朋友可以參考下2014-09-09jQuery動畫出現(xiàn)連續(xù)觸發(fā)、滯后反復(fù)執(zhí)行的解決方法
這篇文章主要介紹了jQuery動畫出現(xiàn)連續(xù)觸發(fā)、滯后反復(fù)執(zhí)行的解決方法,實例分析了針對jQuery中slideUp、slideDown、animate等動畫運用時出現(xiàn)的滯后反復(fù)執(zhí)行等問題的解決方法,需要的朋友可以參考下2015-01-01jquery實現(xiàn)點擊a鏈接,跳轉(zhuǎn)之后,該a鏈接處顯示背景色的方法
下面小編就為大家分享一篇jquery實現(xiàn)點擊a鏈接,跳轉(zhuǎn)之后,該a鏈接處顯示背景色的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-01-01