简体   繁体   English

使用JQuery Mobile中的按钮填充整个内容区域

[英]Filling the entire content area with buttons in JQuery Mobile

I am creating with JQuery Mobile a page containing a header, a content and a footer area. 我正在使用JQuery Mobile创建一个包含页眉,内容和页脚区域的页面。 The entire content area must be split in two sections, 50% each, where each section must be a button, without any rounded corners or spacing, that can decrease or increase in size according to the device used and the layout of the device (portrait or landscape). 整个内容区域必须分为两部分,每部分50%,其中每个部分必须是一个按钮,没有任何圆角或间距,根据使用的设备和设备的布局(纵向),大小可以减小或增大。或风景)。 I have tried several approaches, such as with data-role="controlgroup" and with data-type="horizontal" but it doesn't seem to provide what I want. 我尝试了几种方法,例如使用data-role="controlgroup"和使用data-type="horizontal"但它似乎并不能提供我想要的东西。 Can someone tell me if it's possible in the first place and, if so, what elements and attributes should be used? 有人可以首先告诉我是否可行,如果可以,应该使用哪些元素和属性? Thanks in advance! 提前致谢!

Here's a working example: http://jsfiddle.net/Gajotres/TfzPw/ 这是一个工作示例: http : //jsfiddle.net/Gajotres/TfzPw/

This solution requires: 该解决方案要求:

  1. jQuery Mobile grid (Omar mentioned it in his comment) jQuery Mobile网格(Omar在他的评论中提到了它)

     <div class="ui-grid-a"> <div class="ui-block-a"><a data-role="button" id="custom-btn">Button Left</a></div> <div class="ui-block-b"><a data-role="button" id="custom-btn">Button Right</a></div> </div><!-- /grid-a --> 

    Official documentation: http://jquerymobile.com/demos/1.3.0-rc.1/docs/content/content-grids.html 官方文档: http : //jquerymobile.com/demos/1.3.0-rc.1/docs/content/content-grids.html

  2. Remove rounded corners: 去除圆角:

     $(document).on('pagebeforeshow', '#index', function(){ $('a').buttonMarkup({ corners: false }); }); 

    Official documentation: http://jquerymobile.com/demos/1.3.0-rc.1/docs/buttons/buttons-options.html 官方文档: http : //jquerymobile.com/demos/1.3.0-rc.1/docs/buttons/buttons-options.html

  3. Remove padding on a content div: 删除内容div上的填充:

     #index-content { padding: 0 !important; } 
  4. Remove button margines: 删除按钮边距:

     #custom-btn { margin: 0 !important; } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM