啊,小雪,小雪,来了,来了。从微微的凉风中,从傍晚的喧闹中来了!像春风抖落万树梨花,像天女撒下漫天白絮……你不飘飘悠悠,因为那是骄傲的象征;你不轻轻起舞,因为那是胆小的缩影,听,沙沙沙沙、沙沙沙沙……我好像坐在屋里听那春雨的歌声。
本文实例讲述了jQueryMobile窗体长内容的缺陷与解决方法。分享给大家供大家参考,具体如下:
前面的一篇文章《jQueryMobile之Helloworld与页面切换的方法》没有考虑到窗体中放置长内容的状况
一旦窗体中出现长内容,使用笔者那种固定header与footer的全屏布局是存在缺陷的,
如图所示,长内容最后的内容,直到滚动条拉到最底部也无法穷尽,
而且很有可能的是,虽然现在这个地方的内容是显示为半透明,但往往这个位置是一些提交按钮什么的,
用户根本就没法点,
因此,需要进行改进,把原来的代码:
<!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" rel="nofollow noopener noreferrer" 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>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</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 rel="nofollow noopener noreferrer" href="a.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="info">a</a></li> <li><a rel="nofollow noopener noreferrer" href="b.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="grid">b</a></li> <li><a rel="nofollow noopener noreferrer" 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" rel="nofollow noopener noreferrer" 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>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</p><p>本页还在建设中</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 rel="nofollow noopener noreferrer" href="a.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="info">a</a></li> <li><a rel="nofollow noopener noreferrer" href="b.html" rel="external nofollow" rel="external nofollow" target="_self" data-icon="grid">b</a></li> <li><a rel="nofollow noopener noreferrer" 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>
则可以穷尽页面了,如下图所示:
希望本文所述对大家jQuery程序设计有所帮助。
本文jQueryMobile之窗体长内容的缺陷与解决方法实例分析到此结束。爱不能强求,但爱的关系需要努力维护。很多人都尝过爱情的滋味,它能让我们今天心花怒放,明天却垂头丧气;它能叫我们满怀希望,也能使我们信心尽失。爱掺杂着各种感觉,但这些感觉是变幻无常的,它们不是爱的本身,而是爱的温度,但只要你愿意,就能决定以什么样的态度对待对方。小编再次感谢大家对我们的支持!