使用Jquery Mobile,我正在尝试模拟Quora使用其“添加问题”按钮做了什么。“添加问题”按钮是一个简单的浮动“ + ”,在底部居中对齐。
为了对我的应用程序进行仿真,我使用ui-grid-b创建了一个透明的页脚,并将加号图标放置在块b中
<div data-theme="a" data-role="footer" data-position="fixed">
<h3>
<div class="ui-grid-b">
<div class="ui-block-a" style="text-align: left;"></div>
<div class="ui-block-b" style="text-align: center;">
<a href="#" data-role="button" data-icon="flat-plus" class="ui-nodisc-icon"></a>
</div>
<div class="ui-block-c" style="text-align: right;"></div>
</div><!-- /grid-a -->
</h3>
</div>
主题背景色为:rgba(0,0,0,0); 我在底部确实有一个加号,但是没有什么比Quora能够做到的要高。
我的解决方案不允许用户在页脚中的任何位置触摸和滑动-而quora应用程序没有这种限制。加号按钮几乎是一个孤岛。如何使用JQM实现类似的目标?
无需使用页脚,只需使用内联按钮,然后添加一些CSS使其居中并将其固定在页面底部:
按钮标记(添加了bottomCenter类):
<a href="#" class="ui-btn ui-btn-inline ui-btn-b ui-icon-plus ui-btn-icon-notext ui-corner-all bottomCenter">Add</a>
bottomCenter类的CSS:
.bottomCenter {
position: fixed;
z-index: 9999;
bottom: 4px;
left: 50%;
margin: 0;
margin-left: -15px;
}
较高的z-index使其浮动在其他内容之上,其余的将位置固定在底部中心。
这是一个演示
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句