如何使用jQuery Mobile的

问题描述:

这就是我现在所拥有的格式在ListView一个选择:http://jsfiddle.net/w6PAC/3/如何使用jQuery Mobile的

我想选择按钮以计数的权利,又不影响列表的垂直尺寸和对齐项目。

我曾尝试:

  1. 创建基础上,.ul-li-count类CSS,但只设法打破JQM增强。
  2. 在listview外单独创建按钮,但我无法垂直对齐它们。
  3. 玩场地集,数据角色,divs等没有成功。

AFAIK无法以编程方式调用选择,否则我会向列表视图中添加一个普通按钮。

任何帮助非常感谢,包括对替代文档布局的建议。

如果我理解正确,那么你可以使用一些非常简单的CSS改变的jQuery Mobile的默认布局:

/*absolutely position the <select> to the right side of the <li> and center it within the <li>*/ 
.custom_list .ui-select { 
    position : absolute; 
    right  : 10px; 
    top  : 50%; 
    margin-top : -1.4em; 
} 
/*add some extra padding to the right side of the <li> to make the text wrap properly*/ 
.custom_list .ui-li { 
    padding-right : 80px; 
} 
/*change the position of the <span class="ui-li-count"> to make room for the <select>*/ 
.custom_list .ui-li-count { 
    right : 50px; 
} 

请注意,我用的是.custom_list类为目标的所需<ul>元素,以便为实现此解决办法正确地,您必须从上面的CSS声明中删除.custom_list,或将.custom_list类添加到您要自定义的<ul>元素。

这里是上述解决方案的jsfiddle:http://jsfiddle.net/jasper/w6PAC/4/

+0

辉煌,谢谢! – hplbsh