如果我理解正確,那麼你可以使用一些非常簡單的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/
輝煌,謝謝! – hplbsh